1
$\begingroup$

I am seeking the edge lists of the complements of named graphs on n vertices. At first sight I would use

G=Part[GraphData[n],i]
GC=GraphComplement[G]
edges=EdgeList[GC]

However GraphComplement requires a graph object. How do I convert G into an object accepted by GraphComplement? Thank you.

$\endgroup$
  • 1
    $\begingroup$ What happens if you try GraphComplement[GraphData[GraphData[n][[i]]]]? $\endgroup$ – J. M. is in limbo Jun 26 '16 at 11:18
2
$\begingroup$

GraphData[5] returns a list of specifications of graphs with 5 vertices. Apply GraphData again to such a specification to get an actual graph.

For example,

GraphData[{"Wheel", 5}]

where {"Wheel", 5} is the last element from GraphData[5].

The GraphData documentation page has many such examples.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.