NeighborhoodSubgraph[g,i,r]
gives a subgraph consisting of vertices that can be reached from vertex i within r hops.
NeighborhoodSubgraph[g,i]
gives a subgraph consisting of vertices that can be reached from vertex i.
NeighborhoodSubgraph
NeighborhoodSubgraph[g,i,r]
gives a subgraph consisting of vertices that can be reached from vertex i within r hops.
NeighborhoodSubgraph[g,i]
gives a subgraph consisting of vertices that can be reached from vertex i.
更多信息和选项
- NeighborhoodSubgraph functionality is now available in the built-in Wolfram Language function NeighborhoodGraph.
- To use NeighborhoodSubgraph, you first need to load the Graph Utilities Package using Needs["GraphUtilities`"].
- NeighborhoodSubgraph returns a subgraph consisting of vertices that can be reached from a given vertex within certain hops.
范例
基本范例 (2)
Needs["GraphUtilities`"]This defines a simple directed graph:
g = {1 -> 2, 2 -> 3, 1 -> 3, 2 -> 4, 4 -> 5, 5 -> 6, 6 -> 4};x = Thread[VertexList[g] -> GraphCoordinates[g]];GraphPlot[g, VertexCoordinateRules -> x, VertexLabeling -> True, DirectedEdges -> True]This finds a subgraph from vertices that can be reached from vertex 2 within 1 hop:
sg = NeighborhoodSubgraph[g, 2, 1]NeighborhoodSubgraph has been superseded by NeighborhoodGraph:
g = Graph[{1 -> 2, 2 -> 3, 1 -> 3, 2 -> 4, 4 -> 5, 5 -> 6, 6 -> 4}]EdgeList[NeighborhoodGraph[g, 2, 1, DirectedEdges -> True]]相关指南
-
▪
- Graph Utilities Package ▪
- Graphs & Networks ▪
- Graph Visualization ▪
- Computation on Graphs ▪
- Graph Construction & Representation ▪
- Graphs and Matrices ▪
- Graph Properties & Measurements ▪
- Graph Operations and Modifications ▪
- Statistical Analysis ▪
- Social Network Analysis ▪
- Graph Properties ▪
- Mathematical Data Formats ▪
- Discrete Mathematics
文本
Wolfram Research (2007),NeighborhoodSubgraph,Wolfram 语言函数,https://reference.wolfram.com/language/GraphUtilities/ref/NeighborhoodSubgraph.html.
CMS
Wolfram 语言. 2007. "NeighborhoodSubgraph." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/GraphUtilities/ref/NeighborhoodSubgraph.html.
APA
Wolfram 语言. (2007). NeighborhoodSubgraph. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/GraphUtilities/ref/NeighborhoodSubgraph.html 年
BibTeX
@misc{reference.wolfram_2026_neighborhoodsubgraph, author="Wolfram Research", title="{NeighborhoodSubgraph}", year="2007", howpublished="\url{https://reference.wolfram.com/language/GraphUtilities/ref/NeighborhoodSubgraph.html}", note=[Accessed: 16-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_neighborhoodsubgraph, organization={Wolfram Research}, title={NeighborhoodSubgraph}, year={2007}, url={https://reference.wolfram.com/language/GraphUtilities/ref/NeighborhoodSubgraph.html}, note=[Accessed: 16-August-2026]}