Spectrum of the GraphData
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
I'm new in using Mathematica.
I need to generate graph spectrums for line graphs of all graphs with vertices number smaller than 5.
I used this command to generate all LineGraps:
GraphData[#, "LineGraph"] & /@ GraphData["Connected", 2 ;; 5]
It generates "plots" of all line graphs.
If i try to do this:
GraphData[#, "Spectrum"] & /@ GraphData[#, "LineGraph", ] & /@
GraphData["Connected", 2 ;; 5]
it still generates only the "plots", not spectrum.
Can somebody help me how to generate spectrum of each of these line graphs?
Thanks in advance!
graphs-and-networks
New contributor
apricot is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
4
down vote
favorite
I'm new in using Mathematica.
I need to generate graph spectrums for line graphs of all graphs with vertices number smaller than 5.
I used this command to generate all LineGraps:
GraphData[#, "LineGraph"] & /@ GraphData["Connected", 2 ;; 5]
It generates "plots" of all line graphs.
If i try to do this:
GraphData[#, "Spectrum"] & /@ GraphData[#, "LineGraph", ] & /@
GraphData["Connected", 2 ;; 5]
it still generates only the "plots", not spectrum.
Can somebody help me how to generate spectrum of each of these line graphs?
Thanks in advance!
graphs-and-networks
New contributor
apricot is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
You have a hanging comma inGraphData[#, "LineGraph", ] &
. And you probably want to usGraphData[#, "Spectrum"] & /@ GraphData["Connected", 2 ;; 5]
instead.
– Henrik Schumacher
Sep 8 at 16:35
Unfortunately i removed coma and still it doesn't work and shows plots. I didn;t want GraphData[#, "Spectrum"] & /@ GraphData["Connected", 2 ;; 5] because it shows spectrums of all graphs between 2 and 5 vertices and i want their LineGraph's spectrums (en.wikipedia.org/wiki/Line_graph)
– apricot
Sep 8 at 16:50
1
Perhaps it's good to point out that theGraphData
function merely queries a database. It does not compute anything. You need to pass the name of a graph to it, not the graph itself. Given a graph, you can compute it'sLineGraph
directly, or its spectrum usingEigenvalues@AdjacencyMatrix[graph]
.
– Szabolcs
Sep 8 at 17:18
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
I'm new in using Mathematica.
I need to generate graph spectrums for line graphs of all graphs with vertices number smaller than 5.
I used this command to generate all LineGraps:
GraphData[#, "LineGraph"] & /@ GraphData["Connected", 2 ;; 5]
It generates "plots" of all line graphs.
If i try to do this:
GraphData[#, "Spectrum"] & /@ GraphData[#, "LineGraph", ] & /@
GraphData["Connected", 2 ;; 5]
it still generates only the "plots", not spectrum.
Can somebody help me how to generate spectrum of each of these line graphs?
Thanks in advance!
graphs-and-networks
New contributor
apricot is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I'm new in using Mathematica.
I need to generate graph spectrums for line graphs of all graphs with vertices number smaller than 5.
I used this command to generate all LineGraps:
GraphData[#, "LineGraph"] & /@ GraphData["Connected", 2 ;; 5]
It generates "plots" of all line graphs.
If i try to do this:
GraphData[#, "Spectrum"] & /@ GraphData[#, "LineGraph", ] & /@
GraphData["Connected", 2 ;; 5]
it still generates only the "plots", not spectrum.
Can somebody help me how to generate spectrum of each of these line graphs?
Thanks in advance!
graphs-and-networks
New contributor
apricot is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
apricot is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked Sep 8 at 16:21
apricot
233
233
New contributor
apricot is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
apricot is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
apricot is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
You have a hanging comma inGraphData[#, "LineGraph", ] &
. And you probably want to usGraphData[#, "Spectrum"] & /@ GraphData["Connected", 2 ;; 5]
instead.
– Henrik Schumacher
Sep 8 at 16:35
Unfortunately i removed coma and still it doesn't work and shows plots. I didn;t want GraphData[#, "Spectrum"] & /@ GraphData["Connected", 2 ;; 5] because it shows spectrums of all graphs between 2 and 5 vertices and i want their LineGraph's spectrums (en.wikipedia.org/wiki/Line_graph)
– apricot
Sep 8 at 16:50
1
Perhaps it's good to point out that theGraphData
function merely queries a database. It does not compute anything. You need to pass the name of a graph to it, not the graph itself. Given a graph, you can compute it'sLineGraph
directly, or its spectrum usingEigenvalues@AdjacencyMatrix[graph]
.
– Szabolcs
Sep 8 at 17:18
add a comment |Â
You have a hanging comma inGraphData[#, "LineGraph", ] &
. And you probably want to usGraphData[#, "Spectrum"] & /@ GraphData["Connected", 2 ;; 5]
instead.
– Henrik Schumacher
Sep 8 at 16:35
Unfortunately i removed coma and still it doesn't work and shows plots. I didn;t want GraphData[#, "Spectrum"] & /@ GraphData["Connected", 2 ;; 5] because it shows spectrums of all graphs between 2 and 5 vertices and i want their LineGraph's spectrums (en.wikipedia.org/wiki/Line_graph)
– apricot
Sep 8 at 16:50
1
Perhaps it's good to point out that theGraphData
function merely queries a database. It does not compute anything. You need to pass the name of a graph to it, not the graph itself. Given a graph, you can compute it'sLineGraph
directly, or its spectrum usingEigenvalues@AdjacencyMatrix[graph]
.
– Szabolcs
Sep 8 at 17:18
You have a hanging comma in
GraphData[#, "LineGraph", ] &
. And you probably want to us GraphData[#, "Spectrum"] & /@ GraphData["Connected", 2 ;; 5]
instead.– Henrik Schumacher
Sep 8 at 16:35
You have a hanging comma in
GraphData[#, "LineGraph", ] &
. And you probably want to us GraphData[#, "Spectrum"] & /@ GraphData["Connected", 2 ;; 5]
instead.– Henrik Schumacher
Sep 8 at 16:35
Unfortunately i removed coma and still it doesn't work and shows plots. I didn;t want GraphData[#, "Spectrum"] & /@ GraphData["Connected", 2 ;; 5] because it shows spectrums of all graphs between 2 and 5 vertices and i want their LineGraph's spectrums (en.wikipedia.org/wiki/Line_graph)
– apricot
Sep 8 at 16:50
Unfortunately i removed coma and still it doesn't work and shows plots. I didn;t want GraphData[#, "Spectrum"] & /@ GraphData["Connected", 2 ;; 5] because it shows spectrums of all graphs between 2 and 5 vertices and i want their LineGraph's spectrums (en.wikipedia.org/wiki/Line_graph)
– apricot
Sep 8 at 16:50
1
1
Perhaps it's good to point out that the
GraphData
function merely queries a database. It does not compute anything. You need to pass the name of a graph to it, not the graph itself. Given a graph, you can compute it's LineGraph
directly, or its spectrum using Eigenvalues@AdjacencyMatrix[graph]
.– Szabolcs
Sep 8 at 17:18
Perhaps it's good to point out that the
GraphData
function merely queries a database. It does not compute anything. You need to pass the name of a graph to it, not the graph itself. Given a graph, you can compute it's LineGraph
directly, or its spectrum using Eigenvalues@AdjacencyMatrix[graph]
.– Szabolcs
Sep 8 at 17:18
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
5
down vote
accepted
The problem is that the "LineGraph"
is not necessarily stored in GraphData
and that GraphData[#,
"LineGraph"]&
returns a Graph
object and not a name of the graph. But one can easily compute the spectrum of any Graph
as the eigenvalues if its adjacency matrix:
Eigenvalues[AdjacencyMatrix[GraphData[#, "LineGraph"]]] & /@
GraphData["Connected", 2 ;; 5]
Thank You very much :) I started with Eigenvalues, but later i saw Property "Spectrum" so I tried to use it. Now it works!
– apricot
Sep 8 at 17:14
You're welcome. And enjoy Mathematica!
– Henrik Schumacher
Sep 8 at 17:15
add a comment |Â
up vote
4
down vote
You had two problems.
- You were missing the "Name" subproperty
- You need to use parentheses so that the input is parsed the way you want (
&
has very low precedence):
So, you could get your code working as follows:
GraphData[#, "Spectrum"] & /@ (GraphData[#, "LineGraph", "Name"] &) /@ GraphData["Connected", 2 ;; 5]
GraphData::notdef: GraphData has no value associated with the specified argument(s).
GraphData::notdef: GraphData has no value associated with the specified argument(s).
GraphData::notdef: GraphData has no value associated with the specified argument(s).
General::stop: Further output of GraphData::notdef will be suppressed during this calculation.
-2, -2, Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 1], 0,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 2], 1,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 3], -2,
Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 1], 0, Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 2],
Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 3], 1/2 (-1 - Sqrt[5]),
Root[-2 - 5 #1 - #1^2 + #1^3 &, 1], Root[-2 - 5 #1 - #1^2 + #1^3 &, 2],
1/2 (-1 + Sqrt[5]), Root[-2 - 5 #1 - #1^2 + #1^3 &, 3], -2, -1, -1,
1/2 (3 - Sqrt[17]), 1, 1/2 (3 + Sqrt[17]), -1, -1, 2, -2, -2, 0, 0, 1,
3, -2, -2, 1/2 (3 - Sqrt[33]), 0, 0, 1,
1/2 (3 + Sqrt[33]), Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 1], -1, -1,
Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 2],
Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 3], 1/2 (-1 - Sqrt[5]),
1/2 (-1 - Sqrt[5]), 1/2 (-1 + Sqrt[5]), 1/2 (-1 + Sqrt[5]), 2, -2,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 1], -1, 0,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 2],
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 3], -2, 1 - Sqrt[5], 0, 0,
1 + Sqrt[5], Root[1 - 3 #1 - #1^2 + #1^3 &, 1], -1,
Root[1 - 3 #1 - #1^2 + #1^3 &, 2],
Root[1 - 3 #1 - #1^2 + #1^3 &, 3], -2, -2, -1,
Root[2 - #1 - 4 #1^2 + #1^3 &, 1], Root[2 - #1 - 4 #1^2 + #1^3 &, 2], 1,
Root[2 - #1 - 4 #1^2 + #1^3 &, 3], -2, 1/2 (-1 - Sqrt[5]),
Root[2 - #1 - 3 #1^2 + #1^3 &, 1], 1/2 (-1 + Sqrt[5]),
Root[2 - #1 - 3 #1^2 + #1^3 &, 2], Root[2 - #1 - 3 #1^2 + #1^3 &, 3],
GraphData[Missing["NotAvailable"], "Spectrum"],
GraphData[Missing["NotAvailable"], "Spectrum"], -2,
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 1],
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 2], 0,
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 3],
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 4], -2, -2, 1/2 (3 - Sqrt[33]),
0, 0, 1, 1/2 (3 + Sqrt[33]), 0, -1, 1, -Sqrt[2], 0, Sqrt[
2], 1/2 (-1 - Sqrt[5]), 1/2 (1 - Sqrt[5]), 1/2 (-1 + Sqrt[5]),
1/2 (1 + Sqrt[5]), 1/2 (1 - Sqrt[17]), -1, 0,
1/2 (1 + Sqrt[17]), -2, -2, -2, -2, -2, 1, 1, 1, 1, 6, -2, 0, 0,
2, -1, -1, -1, 3, Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 1], -1,
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 2],
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 3],
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 4], -2, -2, 0, 0, 0, 4, -1, -1,
2, GraphData[Missing["NotAvailable"], "Spectrum"]
Messages are generated because GraphData
does not include all of the line graphs in its database.
A good question would be: given aGraph
, how to find it inGraphData
. One can query all graphs with the same number of vertices, compute theCanonicalGraph
of each, then search based on that. It's ugly though. I wonder if there's something more direct. It could be sped up by pre-filtering by basic properties, such as the edge count.
– Szabolcs
Sep 8 at 17:21
ToEntity: reference.wolfram.com/language/ref/ToEntity.html
– Eric Weisstein
2 days ago
add a comment |Â
up vote
4
down vote
You don't need to use the "LineGraph"
in the middle, just pass the first GraphData
elements to the "Spectrum"
one.
You can try
Table[GraphData[g, "Spectrum"], g, GraphData["Connected", 2 ;; 5]]
Explanation:
GraphData["Connected", 2 ;; 5]
returns a table of elements. You can use the elements from this table to put yet in another GraphData.
Edit:
I just saw your comment about wanting LineGraph
spectra, not the Graph
spectra. However, when you pass a LineGraph
to GraphData[#, "Spectrum"]
, it doesn't work.
The output looks like this:
Are you sure that you don't want this? Because, the way I see it, 2;;5
range has a collection of graphs. For each of these graphs there is a name (1st column), a line graph plot (2nd column) and a spectrum (3rd column):
P.s.:
This is the code for the output above:
Table[
g,
GraphData[g, "LineGraph"],
GraphData[g, "Spectrum"]
,
g, GraphData["Connected", 2 ;; 5]] // TraditionalForm
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
The problem is that the "LineGraph"
is not necessarily stored in GraphData
and that GraphData[#,
"LineGraph"]&
returns a Graph
object and not a name of the graph. But one can easily compute the spectrum of any Graph
as the eigenvalues if its adjacency matrix:
Eigenvalues[AdjacencyMatrix[GraphData[#, "LineGraph"]]] & /@
GraphData["Connected", 2 ;; 5]
Thank You very much :) I started with Eigenvalues, but later i saw Property "Spectrum" so I tried to use it. Now it works!
– apricot
Sep 8 at 17:14
You're welcome. And enjoy Mathematica!
– Henrik Schumacher
Sep 8 at 17:15
add a comment |Â
up vote
5
down vote
accepted
The problem is that the "LineGraph"
is not necessarily stored in GraphData
and that GraphData[#,
"LineGraph"]&
returns a Graph
object and not a name of the graph. But one can easily compute the spectrum of any Graph
as the eigenvalues if its adjacency matrix:
Eigenvalues[AdjacencyMatrix[GraphData[#, "LineGraph"]]] & /@
GraphData["Connected", 2 ;; 5]
Thank You very much :) I started with Eigenvalues, but later i saw Property "Spectrum" so I tried to use it. Now it works!
– apricot
Sep 8 at 17:14
You're welcome. And enjoy Mathematica!
– Henrik Schumacher
Sep 8 at 17:15
add a comment |Â
up vote
5
down vote
accepted
up vote
5
down vote
accepted
The problem is that the "LineGraph"
is not necessarily stored in GraphData
and that GraphData[#,
"LineGraph"]&
returns a Graph
object and not a name of the graph. But one can easily compute the spectrum of any Graph
as the eigenvalues if its adjacency matrix:
Eigenvalues[AdjacencyMatrix[GraphData[#, "LineGraph"]]] & /@
GraphData["Connected", 2 ;; 5]
The problem is that the "LineGraph"
is not necessarily stored in GraphData
and that GraphData[#,
"LineGraph"]&
returns a Graph
object and not a name of the graph. But one can easily compute the spectrum of any Graph
as the eigenvalues if its adjacency matrix:
Eigenvalues[AdjacencyMatrix[GraphData[#, "LineGraph"]]] & /@
GraphData["Connected", 2 ;; 5]
edited 2 days ago
answered Sep 8 at 17:05


Henrik Schumacher
37.5k249105
37.5k249105
Thank You very much :) I started with Eigenvalues, but later i saw Property "Spectrum" so I tried to use it. Now it works!
– apricot
Sep 8 at 17:14
You're welcome. And enjoy Mathematica!
– Henrik Schumacher
Sep 8 at 17:15
add a comment |Â
Thank You very much :) I started with Eigenvalues, but later i saw Property "Spectrum" so I tried to use it. Now it works!
– apricot
Sep 8 at 17:14
You're welcome. And enjoy Mathematica!
– Henrik Schumacher
Sep 8 at 17:15
Thank You very much :) I started with Eigenvalues, but later i saw Property "Spectrum" so I tried to use it. Now it works!
– apricot
Sep 8 at 17:14
Thank You very much :) I started with Eigenvalues, but later i saw Property "Spectrum" so I tried to use it. Now it works!
– apricot
Sep 8 at 17:14
You're welcome. And enjoy Mathematica!
– Henrik Schumacher
Sep 8 at 17:15
You're welcome. And enjoy Mathematica!
– Henrik Schumacher
Sep 8 at 17:15
add a comment |Â
up vote
4
down vote
You had two problems.
- You were missing the "Name" subproperty
- You need to use parentheses so that the input is parsed the way you want (
&
has very low precedence):
So, you could get your code working as follows:
GraphData[#, "Spectrum"] & /@ (GraphData[#, "LineGraph", "Name"] &) /@ GraphData["Connected", 2 ;; 5]
GraphData::notdef: GraphData has no value associated with the specified argument(s).
GraphData::notdef: GraphData has no value associated with the specified argument(s).
GraphData::notdef: GraphData has no value associated with the specified argument(s).
General::stop: Further output of GraphData::notdef will be suppressed during this calculation.
-2, -2, Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 1], 0,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 2], 1,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 3], -2,
Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 1], 0, Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 2],
Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 3], 1/2 (-1 - Sqrt[5]),
Root[-2 - 5 #1 - #1^2 + #1^3 &, 1], Root[-2 - 5 #1 - #1^2 + #1^3 &, 2],
1/2 (-1 + Sqrt[5]), Root[-2 - 5 #1 - #1^2 + #1^3 &, 3], -2, -1, -1,
1/2 (3 - Sqrt[17]), 1, 1/2 (3 + Sqrt[17]), -1, -1, 2, -2, -2, 0, 0, 1,
3, -2, -2, 1/2 (3 - Sqrt[33]), 0, 0, 1,
1/2 (3 + Sqrt[33]), Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 1], -1, -1,
Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 2],
Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 3], 1/2 (-1 - Sqrt[5]),
1/2 (-1 - Sqrt[5]), 1/2 (-1 + Sqrt[5]), 1/2 (-1 + Sqrt[5]), 2, -2,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 1], -1, 0,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 2],
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 3], -2, 1 - Sqrt[5], 0, 0,
1 + Sqrt[5], Root[1 - 3 #1 - #1^2 + #1^3 &, 1], -1,
Root[1 - 3 #1 - #1^2 + #1^3 &, 2],
Root[1 - 3 #1 - #1^2 + #1^3 &, 3], -2, -2, -1,
Root[2 - #1 - 4 #1^2 + #1^3 &, 1], Root[2 - #1 - 4 #1^2 + #1^3 &, 2], 1,
Root[2 - #1 - 4 #1^2 + #1^3 &, 3], -2, 1/2 (-1 - Sqrt[5]),
Root[2 - #1 - 3 #1^2 + #1^3 &, 1], 1/2 (-1 + Sqrt[5]),
Root[2 - #1 - 3 #1^2 + #1^3 &, 2], Root[2 - #1 - 3 #1^2 + #1^3 &, 3],
GraphData[Missing["NotAvailable"], "Spectrum"],
GraphData[Missing["NotAvailable"], "Spectrum"], -2,
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 1],
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 2], 0,
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 3],
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 4], -2, -2, 1/2 (3 - Sqrt[33]),
0, 0, 1, 1/2 (3 + Sqrt[33]), 0, -1, 1, -Sqrt[2], 0, Sqrt[
2], 1/2 (-1 - Sqrt[5]), 1/2 (1 - Sqrt[5]), 1/2 (-1 + Sqrt[5]),
1/2 (1 + Sqrt[5]), 1/2 (1 - Sqrt[17]), -1, 0,
1/2 (1 + Sqrt[17]), -2, -2, -2, -2, -2, 1, 1, 1, 1, 6, -2, 0, 0,
2, -1, -1, -1, 3, Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 1], -1,
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 2],
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 3],
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 4], -2, -2, 0, 0, 0, 4, -1, -1,
2, GraphData[Missing["NotAvailable"], "Spectrum"]
Messages are generated because GraphData
does not include all of the line graphs in its database.
A good question would be: given aGraph
, how to find it inGraphData
. One can query all graphs with the same number of vertices, compute theCanonicalGraph
of each, then search based on that. It's ugly though. I wonder if there's something more direct. It could be sped up by pre-filtering by basic properties, such as the edge count.
– Szabolcs
Sep 8 at 17:21
ToEntity: reference.wolfram.com/language/ref/ToEntity.html
– Eric Weisstein
2 days ago
add a comment |Â
up vote
4
down vote
You had two problems.
- You were missing the "Name" subproperty
- You need to use parentheses so that the input is parsed the way you want (
&
has very low precedence):
So, you could get your code working as follows:
GraphData[#, "Spectrum"] & /@ (GraphData[#, "LineGraph", "Name"] &) /@ GraphData["Connected", 2 ;; 5]
GraphData::notdef: GraphData has no value associated with the specified argument(s).
GraphData::notdef: GraphData has no value associated with the specified argument(s).
GraphData::notdef: GraphData has no value associated with the specified argument(s).
General::stop: Further output of GraphData::notdef will be suppressed during this calculation.
-2, -2, Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 1], 0,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 2], 1,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 3], -2,
Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 1], 0, Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 2],
Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 3], 1/2 (-1 - Sqrt[5]),
Root[-2 - 5 #1 - #1^2 + #1^3 &, 1], Root[-2 - 5 #1 - #1^2 + #1^3 &, 2],
1/2 (-1 + Sqrt[5]), Root[-2 - 5 #1 - #1^2 + #1^3 &, 3], -2, -1, -1,
1/2 (3 - Sqrt[17]), 1, 1/2 (3 + Sqrt[17]), -1, -1, 2, -2, -2, 0, 0, 1,
3, -2, -2, 1/2 (3 - Sqrt[33]), 0, 0, 1,
1/2 (3 + Sqrt[33]), Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 1], -1, -1,
Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 2],
Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 3], 1/2 (-1 - Sqrt[5]),
1/2 (-1 - Sqrt[5]), 1/2 (-1 + Sqrt[5]), 1/2 (-1 + Sqrt[5]), 2, -2,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 1], -1, 0,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 2],
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 3], -2, 1 - Sqrt[5], 0, 0,
1 + Sqrt[5], Root[1 - 3 #1 - #1^2 + #1^3 &, 1], -1,
Root[1 - 3 #1 - #1^2 + #1^3 &, 2],
Root[1 - 3 #1 - #1^2 + #1^3 &, 3], -2, -2, -1,
Root[2 - #1 - 4 #1^2 + #1^3 &, 1], Root[2 - #1 - 4 #1^2 + #1^3 &, 2], 1,
Root[2 - #1 - 4 #1^2 + #1^3 &, 3], -2, 1/2 (-1 - Sqrt[5]),
Root[2 - #1 - 3 #1^2 + #1^3 &, 1], 1/2 (-1 + Sqrt[5]),
Root[2 - #1 - 3 #1^2 + #1^3 &, 2], Root[2 - #1 - 3 #1^2 + #1^3 &, 3],
GraphData[Missing["NotAvailable"], "Spectrum"],
GraphData[Missing["NotAvailable"], "Spectrum"], -2,
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 1],
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 2], 0,
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 3],
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 4], -2, -2, 1/2 (3 - Sqrt[33]),
0, 0, 1, 1/2 (3 + Sqrt[33]), 0, -1, 1, -Sqrt[2], 0, Sqrt[
2], 1/2 (-1 - Sqrt[5]), 1/2 (1 - Sqrt[5]), 1/2 (-1 + Sqrt[5]),
1/2 (1 + Sqrt[5]), 1/2 (1 - Sqrt[17]), -1, 0,
1/2 (1 + Sqrt[17]), -2, -2, -2, -2, -2, 1, 1, 1, 1, 6, -2, 0, 0,
2, -1, -1, -1, 3, Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 1], -1,
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 2],
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 3],
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 4], -2, -2, 0, 0, 0, 4, -1, -1,
2, GraphData[Missing["NotAvailable"], "Spectrum"]
Messages are generated because GraphData
does not include all of the line graphs in its database.
A good question would be: given aGraph
, how to find it inGraphData
. One can query all graphs with the same number of vertices, compute theCanonicalGraph
of each, then search based on that. It's ugly though. I wonder if there's something more direct. It could be sped up by pre-filtering by basic properties, such as the edge count.
– Szabolcs
Sep 8 at 17:21
ToEntity: reference.wolfram.com/language/ref/ToEntity.html
– Eric Weisstein
2 days ago
add a comment |Â
up vote
4
down vote
up vote
4
down vote
You had two problems.
- You were missing the "Name" subproperty
- You need to use parentheses so that the input is parsed the way you want (
&
has very low precedence):
So, you could get your code working as follows:
GraphData[#, "Spectrum"] & /@ (GraphData[#, "LineGraph", "Name"] &) /@ GraphData["Connected", 2 ;; 5]
GraphData::notdef: GraphData has no value associated with the specified argument(s).
GraphData::notdef: GraphData has no value associated with the specified argument(s).
GraphData::notdef: GraphData has no value associated with the specified argument(s).
General::stop: Further output of GraphData::notdef will be suppressed during this calculation.
-2, -2, Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 1], 0,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 2], 1,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 3], -2,
Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 1], 0, Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 2],
Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 3], 1/2 (-1 - Sqrt[5]),
Root[-2 - 5 #1 - #1^2 + #1^3 &, 1], Root[-2 - 5 #1 - #1^2 + #1^3 &, 2],
1/2 (-1 + Sqrt[5]), Root[-2 - 5 #1 - #1^2 + #1^3 &, 3], -2, -1, -1,
1/2 (3 - Sqrt[17]), 1, 1/2 (3 + Sqrt[17]), -1, -1, 2, -2, -2, 0, 0, 1,
3, -2, -2, 1/2 (3 - Sqrt[33]), 0, 0, 1,
1/2 (3 + Sqrt[33]), Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 1], -1, -1,
Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 2],
Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 3], 1/2 (-1 - Sqrt[5]),
1/2 (-1 - Sqrt[5]), 1/2 (-1 + Sqrt[5]), 1/2 (-1 + Sqrt[5]), 2, -2,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 1], -1, 0,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 2],
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 3], -2, 1 - Sqrt[5], 0, 0,
1 + Sqrt[5], Root[1 - 3 #1 - #1^2 + #1^3 &, 1], -1,
Root[1 - 3 #1 - #1^2 + #1^3 &, 2],
Root[1 - 3 #1 - #1^2 + #1^3 &, 3], -2, -2, -1,
Root[2 - #1 - 4 #1^2 + #1^3 &, 1], Root[2 - #1 - 4 #1^2 + #1^3 &, 2], 1,
Root[2 - #1 - 4 #1^2 + #1^3 &, 3], -2, 1/2 (-1 - Sqrt[5]),
Root[2 - #1 - 3 #1^2 + #1^3 &, 1], 1/2 (-1 + Sqrt[5]),
Root[2 - #1 - 3 #1^2 + #1^3 &, 2], Root[2 - #1 - 3 #1^2 + #1^3 &, 3],
GraphData[Missing["NotAvailable"], "Spectrum"],
GraphData[Missing["NotAvailable"], "Spectrum"], -2,
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 1],
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 2], 0,
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 3],
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 4], -2, -2, 1/2 (3 - Sqrt[33]),
0, 0, 1, 1/2 (3 + Sqrt[33]), 0, -1, 1, -Sqrt[2], 0, Sqrt[
2], 1/2 (-1 - Sqrt[5]), 1/2 (1 - Sqrt[5]), 1/2 (-1 + Sqrt[5]),
1/2 (1 + Sqrt[5]), 1/2 (1 - Sqrt[17]), -1, 0,
1/2 (1 + Sqrt[17]), -2, -2, -2, -2, -2, 1, 1, 1, 1, 6, -2, 0, 0,
2, -1, -1, -1, 3, Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 1], -1,
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 2],
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 3],
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 4], -2, -2, 0, 0, 0, 4, -1, -1,
2, GraphData[Missing["NotAvailable"], "Spectrum"]
Messages are generated because GraphData
does not include all of the line graphs in its database.
You had two problems.
- You were missing the "Name" subproperty
- You need to use parentheses so that the input is parsed the way you want (
&
has very low precedence):
So, you could get your code working as follows:
GraphData[#, "Spectrum"] & /@ (GraphData[#, "LineGraph", "Name"] &) /@ GraphData["Connected", 2 ;; 5]
GraphData::notdef: GraphData has no value associated with the specified argument(s).
GraphData::notdef: GraphData has no value associated with the specified argument(s).
GraphData::notdef: GraphData has no value associated with the specified argument(s).
General::stop: Further output of GraphData::notdef will be suppressed during this calculation.
-2, -2, Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 1], 0,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 2], 1,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 3], -2,
Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 1], 0, Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 2],
Root[2 - 2 #1 - 2 #1^2 + #1^3 &, 3], 1/2 (-1 - Sqrt[5]),
Root[-2 - 5 #1 - #1^2 + #1^3 &, 1], Root[-2 - 5 #1 - #1^2 + #1^3 &, 2],
1/2 (-1 + Sqrt[5]), Root[-2 - 5 #1 - #1^2 + #1^3 &, 3], -2, -1, -1,
1/2 (3 - Sqrt[17]), 1, 1/2 (3 + Sqrt[17]), -1, -1, 2, -2, -2, 0, 0, 1,
3, -2, -2, 1/2 (3 - Sqrt[33]), 0, 0, 1,
1/2 (3 + Sqrt[33]), Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 1], -1, -1,
Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 2],
Root[2 - 5 #1 - 2 #1^2 + #1^3 &, 3], 1/2 (-1 - Sqrt[5]),
1/2 (-1 - Sqrt[5]), 1/2 (-1 + Sqrt[5]), 1/2 (-1 + Sqrt[5]), 2, -2,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 1], -1, 0,
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 2],
Root[4 - 4 #1 - 3 #1^2 + #1^3 &, 3], -2, 1 - Sqrt[5], 0, 0,
1 + Sqrt[5], Root[1 - 3 #1 - #1^2 + #1^3 &, 1], -1,
Root[1 - 3 #1 - #1^2 + #1^3 &, 2],
Root[1 - 3 #1 - #1^2 + #1^3 &, 3], -2, -2, -1,
Root[2 - #1 - 4 #1^2 + #1^3 &, 1], Root[2 - #1 - 4 #1^2 + #1^3 &, 2], 1,
Root[2 - #1 - 4 #1^2 + #1^3 &, 3], -2, 1/2 (-1 - Sqrt[5]),
Root[2 - #1 - 3 #1^2 + #1^3 &, 1], 1/2 (-1 + Sqrt[5]),
Root[2 - #1 - 3 #1^2 + #1^3 &, 2], Root[2 - #1 - 3 #1^2 + #1^3 &, 3],
GraphData[Missing["NotAvailable"], "Spectrum"],
GraphData[Missing["NotAvailable"], "Spectrum"], -2,
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 1],
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 2], 0,
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 3],
Root[4 + 2 #1 - 6 #1^2 - 2 #1^3 + #1^4 &, 4], -2, -2, 1/2 (3 - Sqrt[33]),
0, 0, 1, 1/2 (3 + Sqrt[33]), 0, -1, 1, -Sqrt[2], 0, Sqrt[
2], 1/2 (-1 - Sqrt[5]), 1/2 (1 - Sqrt[5]), 1/2 (-1 + Sqrt[5]),
1/2 (1 + Sqrt[5]), 1/2 (1 - Sqrt[17]), -1, 0,
1/2 (1 + Sqrt[17]), -2, -2, -2, -2, -2, 1, 1, 1, 1, 6, -2, 0, 0,
2, -1, -1, -1, 3, Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 1], -1,
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 2],
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 3],
Root[2 + #1 - 5 #1^2 - #1^3 + #1^4 &, 4], -2, -2, 0, 0, 0, 4, -1, -1,
2, GraphData[Missing["NotAvailable"], "Spectrum"]
Messages are generated because GraphData
does not include all of the line graphs in its database.
answered Sep 8 at 17:11


Carl Woll
56.3k272147
56.3k272147
A good question would be: given aGraph
, how to find it inGraphData
. One can query all graphs with the same number of vertices, compute theCanonicalGraph
of each, then search based on that. It's ugly though. I wonder if there's something more direct. It could be sped up by pre-filtering by basic properties, such as the edge count.
– Szabolcs
Sep 8 at 17:21
ToEntity: reference.wolfram.com/language/ref/ToEntity.html
– Eric Weisstein
2 days ago
add a comment |Â
A good question would be: given aGraph
, how to find it inGraphData
. One can query all graphs with the same number of vertices, compute theCanonicalGraph
of each, then search based on that. It's ugly though. I wonder if there's something more direct. It could be sped up by pre-filtering by basic properties, such as the edge count.
– Szabolcs
Sep 8 at 17:21
ToEntity: reference.wolfram.com/language/ref/ToEntity.html
– Eric Weisstein
2 days ago
A good question would be: given a
Graph
, how to find it in GraphData
. One can query all graphs with the same number of vertices, compute the CanonicalGraph
of each, then search based on that. It's ugly though. I wonder if there's something more direct. It could be sped up by pre-filtering by basic properties, such as the edge count.– Szabolcs
Sep 8 at 17:21
A good question would be: given a
Graph
, how to find it in GraphData
. One can query all graphs with the same number of vertices, compute the CanonicalGraph
of each, then search based on that. It's ugly though. I wonder if there's something more direct. It could be sped up by pre-filtering by basic properties, such as the edge count.– Szabolcs
Sep 8 at 17:21
ToEntity: reference.wolfram.com/language/ref/ToEntity.html
– Eric Weisstein
2 days ago
ToEntity: reference.wolfram.com/language/ref/ToEntity.html
– Eric Weisstein
2 days ago
add a comment |Â
up vote
4
down vote
You don't need to use the "LineGraph"
in the middle, just pass the first GraphData
elements to the "Spectrum"
one.
You can try
Table[GraphData[g, "Spectrum"], g, GraphData["Connected", 2 ;; 5]]
Explanation:
GraphData["Connected", 2 ;; 5]
returns a table of elements. You can use the elements from this table to put yet in another GraphData.
Edit:
I just saw your comment about wanting LineGraph
spectra, not the Graph
spectra. However, when you pass a LineGraph
to GraphData[#, "Spectrum"]
, it doesn't work.
The output looks like this:
Are you sure that you don't want this? Because, the way I see it, 2;;5
range has a collection of graphs. For each of these graphs there is a name (1st column), a line graph plot (2nd column) and a spectrum (3rd column):
P.s.:
This is the code for the output above:
Table[
g,
GraphData[g, "LineGraph"],
GraphData[g, "Spectrum"]
,
g, GraphData["Connected", 2 ;; 5]] // TraditionalForm
add a comment |Â
up vote
4
down vote
You don't need to use the "LineGraph"
in the middle, just pass the first GraphData
elements to the "Spectrum"
one.
You can try
Table[GraphData[g, "Spectrum"], g, GraphData["Connected", 2 ;; 5]]
Explanation:
GraphData["Connected", 2 ;; 5]
returns a table of elements. You can use the elements from this table to put yet in another GraphData.
Edit:
I just saw your comment about wanting LineGraph
spectra, not the Graph
spectra. However, when you pass a LineGraph
to GraphData[#, "Spectrum"]
, it doesn't work.
The output looks like this:
Are you sure that you don't want this? Because, the way I see it, 2;;5
range has a collection of graphs. For each of these graphs there is a name (1st column), a line graph plot (2nd column) and a spectrum (3rd column):
P.s.:
This is the code for the output above:
Table[
g,
GraphData[g, "LineGraph"],
GraphData[g, "Spectrum"]
,
g, GraphData["Connected", 2 ;; 5]] // TraditionalForm
add a comment |Â
up vote
4
down vote
up vote
4
down vote
You don't need to use the "LineGraph"
in the middle, just pass the first GraphData
elements to the "Spectrum"
one.
You can try
Table[GraphData[g, "Spectrum"], g, GraphData["Connected", 2 ;; 5]]
Explanation:
GraphData["Connected", 2 ;; 5]
returns a table of elements. You can use the elements from this table to put yet in another GraphData.
Edit:
I just saw your comment about wanting LineGraph
spectra, not the Graph
spectra. However, when you pass a LineGraph
to GraphData[#, "Spectrum"]
, it doesn't work.
The output looks like this:
Are you sure that you don't want this? Because, the way I see it, 2;;5
range has a collection of graphs. For each of these graphs there is a name (1st column), a line graph plot (2nd column) and a spectrum (3rd column):
P.s.:
This is the code for the output above:
Table[
g,
GraphData[g, "LineGraph"],
GraphData[g, "Spectrum"]
,
g, GraphData["Connected", 2 ;; 5]] // TraditionalForm
You don't need to use the "LineGraph"
in the middle, just pass the first GraphData
elements to the "Spectrum"
one.
You can try
Table[GraphData[g, "Spectrum"], g, GraphData["Connected", 2 ;; 5]]
Explanation:
GraphData["Connected", 2 ;; 5]
returns a table of elements. You can use the elements from this table to put yet in another GraphData.
Edit:
I just saw your comment about wanting LineGraph
spectra, not the Graph
spectra. However, when you pass a LineGraph
to GraphData[#, "Spectrum"]
, it doesn't work.
The output looks like this:
Are you sure that you don't want this? Because, the way I see it, 2;;5
range has a collection of graphs. For each of these graphs there is a name (1st column), a line graph plot (2nd column) and a spectrum (3rd column):
P.s.:
This is the code for the output above:
Table[
g,
GraphData[g, "LineGraph"],
GraphData[g, "Spectrum"]
,
g, GraphData["Connected", 2 ;; 5]] // TraditionalForm
edited Sep 8 at 17:11
answered Sep 8 at 16:54


Chanto
1959
1959
add a comment |Â
add a comment |Â
apricot is a new contributor. Be nice, and check out our Code of Conduct.
apricot is a new contributor. Be nice, and check out our Code of Conduct.
apricot is a new contributor. Be nice, and check out our Code of Conduct.
apricot is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f181507%2fspectrum-of-the-graphdata%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
You have a hanging comma in
GraphData[#, "LineGraph", ] &
. And you probably want to usGraphData[#, "Spectrum"] & /@ GraphData["Connected", 2 ;; 5]
instead.– Henrik Schumacher
Sep 8 at 16:35
Unfortunately i removed coma and still it doesn't work and shows plots. I didn;t want GraphData[#, "Spectrum"] & /@ GraphData["Connected", 2 ;; 5] because it shows spectrums of all graphs between 2 and 5 vertices and i want their LineGraph's spectrums (en.wikipedia.org/wiki/Line_graph)
– apricot
Sep 8 at 16:50
1
Perhaps it's good to point out that the
GraphData
function merely queries a database. It does not compute anything. You need to pass the name of a graph to it, not the graph itself. Given a graph, you can compute it'sLineGraph
directly, or its spectrum usingEigenvalues@AdjacencyMatrix[graph]
.– Szabolcs
Sep 8 at 17:18