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
  • 1
    $\begingroup$ What happens if you try GraphComplement[GraphData[GraphData[n][[i]]]]? $\endgroup$ Jun 26, 2016 at 11:18

1 Answer 1

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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