Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Directed and undirected graphs, network analysis

Graphs model the connections in a network and are widely applicable to a variety of physical, biological, and information systems. You can use graphs to model the neurons in a brain, the flight patterns of an airline, and much more. The structure of a graph is comprised of “nodes” and “edges”. Each node represents an entity, and each edge represents a connection between two nodes. For more information, see Directed and Undirected Graphs.

`addnode` | Add new node to graph |

`rmnode` | Remove node from graph |

`addedge` | Add new edge to graph |

`rmedge` | Remove edge from graph |

`flipedge` | Reverse edge directions |

`numnodes` | Number of nodes in graph |

`numedges` | Number of edges in graph |

`findnode` | Locate node in graph |

`findedge` | Locate edge in graph |

`reordernodes` | Reorder graph nodes |

`subgraph` | Extract subgraph |

`bfsearch` | Breadth-first graph search |

`dfsearch` | Depth-first graph search |

`centrality` | Measure node importance |

`maxflow` | Maximum flow in graph |

`conncomp` | Connected graph components |

`biconncomp` | Biconnected graph components |

`condensation` | Graph condensation |

`bctree` | Block-cut tree graph |

`minspantree` | Minimum spanning tree of graph |

`toposort` | Topological order of directed acyclic graph |

`isdag` | Determine if graph is acyclic |

`transclosure` | Transitive closure |

`transreduction` | Transitive reduction |

`isisomorphic` | Determine whether two graphs are isomorphic |

`isomorphism` | Compute equivalence relation between two graphs |

`shortestpath` | Shortest path between two single nodes |

`shortestpathtree` | Shortest path tree from node |

`distances` | Shortest path distances of all node pairs |

`degree` | Degree of graph nodes |

`neighbors` | Neighbors of graph node |

`nearest` | Nearest neighbors within radius |

`indegree` | In-degree of nodes |

`outdegree` | Out-degree of nodes |

`predecessors` | Node predecessors |

`successors` | Node successors |

`GraphPlot` | Graph plot for directed and undirected graphs |

GraphPlot Properties | Control graph plot appearance and behavior |

**Directed and Undirected Graphs**

Introduction to directed and undirected graphs.

**Modify Nodes and Edges of Existing Graph**

This example shows how to access and modify the nodes and/or edges in a `graph`

or `digraph`

object using the `addedge`

, `rmedge`

, `addnode`

, `rmnode`

, `findedge`

, `findnode`

, and `subgraph`

functions.

**Add Graph Node Names, Edge Weights, and Other Attributes**

This example shows how to add attributes to the nodes and edges in graphs created using `graph`

and `digraph`

.

**Graph Plotting and Customization**

This example shows how to plot graphs, and then customize the display to add labels or highlighting to the graph nodes and edges.

**Add Node Properties to Graph Plot Data Cursor**

This example shows how to customize the `GraphPlot`

data cursor to display extra node properties of a graph.

**Visualize Breadth-First and Depth-First Search**

This example shows how to define a function that visualizes the results of `bfsearch`

and `dfsearch`

by highlighting the nodes and edges of a graph.

**Build Watts-Strogatz Small World Graph Model**

This example shows how to construct and analyze a Watts-Strogatz small-world graph.

**Use PageRank Algorithm to Rank Websites**

This example shows how to use a PageRank algorithm to rank a collection of websites.

**Partition Graph with Laplacian Matrix**

This example shows how to use the Laplacian matrix of a graph to compute the Fiedler vector.

Was this topic helpful?