


Any edge can connect any two vertices that aren't already connected by an identical edge (in the same direction, in the case of a directed graph).Consists of a set of vertices (or nodes) and a set of edges connecting some or all of them.Undirected graph, image source: Wikipedia The other answers are useful, but they're missing the properties of each: Graph Those will answer almost all your questions on trees and graphs. Many real world examples can be considered as graphs. The points which lead to this node are called predecessors and the points which this node will lead to are called successors.Įlectrical circuit diagram, the plan of a house, computer network or a river system are few more examples of graphs. If you consider each city as a node, it can be reached from multiple points. In real world, you can represent almost anything using graphs. But graphs can have multiple predecessors(term parent is generally not used for graphs). Trees are used at places where we know that each node has only one parent. Yes a map can be visualised as a graph data structure. Instead of explaining I prefer to show it in pictures.
