2
$\begingroup$

When I enter for example

G = Part[GraphData[10],1];
LG = LineGraph[G];

I get error message that LineGraph requires a graph object.

How do I convert G into an object accepted by LineGraph? I am using version 9 of Mathematica without Combinatorica explicitly loaded. No doubt a very simple question. Thank you.

$\endgroup$

2 Answers 2

2
$\begingroup$

You are trying to get at the graph {"Antiprism",5} since you get:

G = Part[GraphData[10],1]
(* Output: {"Antiprism",5} *)

After that, you actually need to use "LineGraph" as an argument for GraphData as:

GraphData[G, "LineGraph"]

That should give you the line graph of your G.

$\endgroup$
2
$\begingroup$

How do I convert G into an object accepted by LineGraph?

Wrap it with GraphData:

G = Part[GraphData[10], 1];

LG = LineGraph[GraphData@G]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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