Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between a directed and undirected graph

Tags:

What is the difference between these fundamental types?

In drawings I see that the directed has arrows, but what exactly is meant by these arrows in the directed graph and the lack thereof in the undirected graph?

like image 507
user3492121 Avatar asked May 30 '14 14:05

user3492121


People also ask

What do you mean by graph explain directed and undirected graph with example?

An undirected graph is graph, i.e., a set of objects (called vertices or nodes) that are connected together, where all the edges are bidirectional. An undirected graph is sometimes called an undirected network. In contrast, a graph where the edges point in a direction is called a directed graph.

How do you tell if a graph is directed or undirected by the adjacency matrix?

The adjacency matrix of a simple labeled graph is the matrix A with A[[i,j]] or 0 according to whether the vertex vj, is adjacent to the vertex vj or not. For simple graphs without self-loops, the adjacency matrix has 0 s on the diagonal. For undirected graphs, the adjacency matrix is symmetric.

What is a undirected graph in data structure?

An undirected graph is a set of nodes and a set of links between the nodes. Each node is called a vertex, each link is called an edge, and each edge connects two vertices. The order of the two connected vertices is unimportant. An undirected graph is a finite set of vertices together with a finite set of edges.

What is meant by directed graph?

A directed graph (or digraph) is a set of nodes connected by edges, where the edges have a direction associated with them. For example, an arc (x, y) is considered to be directed from x to y, and the arc (y, x) is the inverted link. Y is a direct successor of x, and x is a direct predecessor of y.


2 Answers

It means exactly what it sounds like. In a directed graph, direction matters. i.e. edge 2->3 means that edge is directed. There is only an edge from 2 to 3 and no edge from 3 to 2. Therefore you can go from vertex 2 to vertex 3 but not from 3 to 2.

In undirected graph 2-3 means the edge has no direction, i.e. 2-3 means you can go both from 2 to 3 and 3 to 2.

Note that in the representation of your graph, if you are using an adjacency matrix, directed 2->3 means adj[2][3]=true but adj[3][2]=false. In undirected it means adj[2][3]=adj[3][2]=true.

like image 189
Kartik_Koro Avatar answered Sep 28 '22 04:09

Kartik_Koro


The difference is the same as between one directional and bidirectional streets - in directed graph, the direction matters and you can't use the edge in the other direction. An undirected graph can be simulated using a directed graph by using pairs of edges in both directions.

like image 39
Danstahr Avatar answered Sep 28 '22 05:09

Danstahr