What is the difference between a directed and undirected graph

后端 未结 7 1175
花落未央
花落未央 2021-02-05 06:02

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 a

相关标签:
7条回答
  • 2021-02-05 07:05

    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.

    0 讨论(0)
提交回复
热议问题