Identifying nodes in a Graph

@danielw2904 what about something like this?

function makemetagraph(df, customer, item)
        G = MetaGraph(
                DiGraph(),
                EdgeMeta = Int64,
                defaultweight = 0,
                weightfunction = identity,
        )
        for group in groupby(df, [customer, item])
                customer_id = Symbol(group[1, customer])
                item_name = Symbol(group[1, item])
                G[customer_id] = nothing
                G[item_name] = nothing
                G[customer_id, item_name] = size(group, 1)
        end
        return G
end
1 Like