10.09.2013 Views

1. Advanced Data Structure using C++

1. Advanced Data Structure using C++

1. Advanced Data Structure using C++

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Definitions :<br />

LECTURE NOTES OF ADVANCED DATA STRUCTURE (MT-CSE 110)<br />

GRAPHS<br />

Graph: nodes/vertices, and edges/arcs as pairs of nodes. {V, E} e12=(v1, v2, l12)<br />

The third term l12, if present, could be a label or the weight of an edge.<br />

Directed graph: edges are ordered pairs of nodes.<br />

Weighted graph: each edge (directed/undirected) has a weight.<br />

Path between a pair of nodes: sequence of edges with those two nodes at the<br />

two ends.<br />

Simple path: covers no node in it twice.<br />

Loop: a path with the same start and end node.<br />

Path length: number of edges in it.<br />

Path weight: total wt of all edges in it.<br />

Connected graph: there exists a path between every node, no node is<br />

disconnected.<br />

Complete graph: edge between every pair of nodes.<br />

Acyclic graph: a graph with no cycles.<br />

Graphs are one of the most used models of real‐life problems for computer‐<br />

solutions.<br />

Representations: visual pictures are not useful data structures for storing a<br />

graph! Adjacency list (link list of directly connected nodes for each node), and<br />

matrix are two representations. The second one is less efficient but easy to use,<br />

while the first one is good for sparse graph (sparsely distributed edges, less<br />

connected).<br />

DEFINING GRAPH:<br />

A graph g consist of a set V of vertices(nodes) and a set E of edges(arcs).We<br />

write G=(V,E),V is a finite and non empty set of vertices .E is a set of pairs of<br />

vertices ,their pairs are called edges .therefore ,<br />

Prepared By :­<br />

Er. Harvinder Singh<br />

Assist Prof., CSE, H.C.T.M (Kaithal) Page ‐ 72 ‐

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!