Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • $\begingroup$ Why does NeighbourhoodGraph need to invoke the layout algorithm? Computing the layout is not necessary if the graph is never shown (like here) ... Is this behaviour intentional or is this a bug? $\endgroup$ Commented Nov 14, 2012 at 14:56
  • $\begingroup$ @Szabolcs It is so that NeighborhoodGraph could be used with HighlightGraph, e.g. gr = GridGraph[{3, 3, 3, 3}]; HighlightGraph[gr, NeighborhoodGraph[gr, 1, 1]]. $\endgroup$ Commented Nov 14, 2012 at 15:28
  • $\begingroup$ In the meantime R.M. told me in the chatroom that NeighborhoodGraph preserves layout information (original vertex coordinates), which is useful sometimes. This information isn't really necessary for HighlightGraph though, for example HighlightGraph[g, Subgraph[g, VertexList@NeighborhoodGraph[g, 1]]] works even though Subgraph doesn't seem to preserve the original vertex coordinates. $\endgroup$ Commented Nov 14, 2012 at 15:33
  • 1
    $\begingroup$ I'm sure many people are hit by this issue and they never realise what the solution is ... they probably just conclude that Mathematica is too slow for these kinds of computations which is of course not the case ... I really wish that people in charge of developing the graph functionality would consider this. Do you suggest I send a suggestion to support about this? $\endgroup$ Commented Jan 20, 2013 at 1:20
  • 2
    $\begingroup$ A question: do you know why SetOptions[NeighborhoodGraph, GraphLayout -> None] doesn't do what one would expect it to? NeighborhoodGraph is still slow unless I pass the GraphLayout -> None with each call. $\endgroup$ Commented Jan 20, 2013 at 1:27