example we can associate with an object-oriented program graph whose vertices represent the classes defined in the programand whose edges indicate inheritance between classes there is an edge from vertex to vertex if the class for inherits from the class for such edges are directed because the inheritance relation only goes in one direction (that isit is asymmetricif all the edges in graph are undirectedthen we say the graph is an undirected graph likewisea directed graphalso called digraphis graph whose edges are all directed graph that has both directed and undirected edges is often called mixed graph note that an undirected or mixed graph can be converted into directed graph by replacing every undirected edge (uvby the pair of directed edges (uvand (vuit is often usefulhoweverto keep undirected and mixed graphs represented as they arefor such graphs have several applicationsas in the following example example city map can be modeled as graph whose vertices are intersections or dead endsand whose edges are stretches of streets without intersections this graph has both undirected edgeswhich correspond to stretches of two-way streetsand directed edgeswhich correspond to stretches of one-way streets thusin this waya graph modeling city map is mixed graph example physical examples of graphs are present in the electrical wiring and plumbing networks of building such networks can be modeled as graphswhere each connectorfixtureor outlet is viewed as vertexand each uninterrupted stretch of wire or pipe is viewed as an edge such graphs are actually components of much larger graphsnamely the local power and water distribution networks depending on the specific aspects of these graphs that we are interested inwe may consider their edges as undirected or directedforin principlewater can flow in pipe and current can flow in wire in either direction the two vertices joined by an edge are called the end vertices (or endpointsof the edge if an edge is directedits first endpoint is its origin and the other is the destination of the edge two vertices and are said to be adjacent if there is an edge whose end vertices are and an edge is said to be incident to vertex if the vertex is one of the edge' endpoints the outgoing edges of vertex are the directed edges whose origin is that vertex the incoming edges of vertex are the directed edges whose destination is that vertex the degree of vertex vdenoted deg( )is the number of incident edges of the in-degree and out-degree of vertex are the number of the incoming and outgoing edges of vand are denoted indeg(vand outdeg( )respectively