-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Description
Hey, thank you for all your awesome work on graphs! : )
I have a request: could you add to operators the function line_graph?
Could be something as simple as:
function line_graph(g::SimpleGraph)
edge_list = collect(edges(g))
n_edges = length(edge_list)
lg = SimpleGraph(n_edges)
for i = 1:n_edges-1
ei = edge_list[i]
for j = i+1:n_edges
ej = edge_list[j]
if !isempty(intersect((src(ei), dst(ei)), (src(ej), dst(ej))))
add_edge!(lg, i, j)
end
end
end
return lg
end
Metadata
Metadata
Assignees
Labels
No labels