I am trying to change the Head of b (a NeighborhoodGraph) from Graph into List but Apply seems to fail. I start with a list of connected vertices:
a={1\[UndirectedEdge]1,2\[UndirectedEdge]2,1\[UndirectedEdge]3,3\[UndirectedEdge]3,
4\[UndirectedEdge]4,3\[UndirectedEdge]4,5\[UndirectedEdge]5,6\[UndirectedEdge]6,
6\[UndirectedEdge]2,7\[UndirectedEdge]7,8\[UndirectedEdge]5,8\[UndirectedEdge]8,
9\[UndirectedEdge]9,10\[UndirectedEdge]10,10\[UndirectedEdge]4};
I calculate the neighborhood graph of node 3. Its Head is Graph:
b=NeighborhoodGraph[a//Graph,3]
b//Head
(* ==> Graph *)
I use Apply to change the Head to List:
c=Apply[List,b];
However, the Head of c is still Graph:
c//Head
(* ==> Graph *)
My real question is how to access the list of edges in a NeighborhoodGraph.
Graph[]
is an atomic object, you cannot useApply[]
to extract the edges; instead, look upEdgeList[]
. $\endgroup$Graph
help page in the "Related guides" section. So, it wasn't really that far away. $\endgroup$