This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.

# Subgraph

 Subgraph gives the subgraph of the graph g generated by the vertices . Subgraphgives the subgraph generated by the edges . Subgraphgives the subgraph generated by the vertices and edges that match the pattern patt.
• The subgraph generated by the vertices includes the vertices and all edges connecting them in the original graph g.
• The subgraph generated by the edges includes the edges and all vertices they are connected to in the original graph g.
Give a subgraph of a complete graph:
Highlight the subgraph within the main graph:
Give a subgraph of a complete graph:
 Out[1]=
 Out[2]=
Highlight the subgraph within the main graph:
 Out[3]=
 Scope   (4)
Subgraph works with undirected graphs:
Directed graphs:
Use patterns to select subgraphs:
Find the subgraph with edges that are incident to 3:
Find the subgraph with vertices less than 6:
Works with large graphs:
 Applications   (2)
Select random subgraphs of size 5:
Find all the subgraphs of the graph g that are isomorphic to the graph h:
Enumerate all subsets of vertices that have the same number of vertices as h:
Select the subgraphs that are isomorphic to h:
Highlight them:
The vertices of subgraphs are subsets of the original vertices:
The edges of subgraphs are subsets of the original edges:
The subgraph of a complete graph is a complete graph:
Subtract random neighborhoods from a grid:
New in 8