1 cs 410 mastery in programming chapter 6 graphs, focus: strongly connected components herbert g....

25
1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS Herbert G. Mayer, PSU CS status 7/25/2011 status 7/25/2011

Post on 19-Dec-2015

219 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

1

CS 410Mastery in Programming

Chapter 6Graphs, Focus:

Strongly Connected Components

Herbert G. Mayer, PSU CSHerbert G. Mayer, PSU CSstatus 7/25/2011status 7/25/2011

Page 2: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

2

Syllabus Definition of GraphDefinition of Graph

Building a GraphBuilding a Graph

Graph Data StructureGraph Data Structure

Strongly Connected ComponentStrongly Connected Component

Control Flow GraphControl Flow Graph

Reducing Graph to DAGReducing Graph to DAG

ReferencesReferences

Page 3: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

3

Formal Definition of GraphEmpty Graph: For simplicity and expediency we ignore the possibility of a graph G Empty Graph: For simplicity and expediency we ignore the possibility of a graph G

being emptybeing empty

Graph: is a data structure G = { V, E } consisting of a set E of edges and a set of V Graph: is a data structure G = { V, E } consisting of a set E of edges and a set of V vertices, AKA nodes. Any node vvertices, AKA nodes. Any node vii ϵϵ V may be connected to any other node v V may be connected to any other node vjj. . Such a connection is called an edge. Edges may be directed, or even bi-Such a connection is called an edge. Edges may be directed, or even bi-directed. Different from a tree, a node in G may have any number of directed. Different from a tree, a node in G may have any number of predecessors –or incident edgespredecessors –or incident edges

Connected Graph: If all n>0 nodes vConnected Graph: If all n>0 nodes vnn in G are connected somehow, the graph G is in G are connected somehow, the graph G is called connected, regardless of the edges’ directionscalled connected, regardless of the edges’ directions

Strongly Connected ComponentStrongly Connected Component: A subset SG : A subset SG ⊆⊆ G is strongly connected, if G is strongly connected, if every of i>0 nodes vevery of i>0 nodes vi i in SG can reach all vin SG can reach all vi i nodes in SG somehownodes in SG somehow

Directed Acyclic Graph (DAG): A DAG is a graph with directed edges that form no Directed Acyclic Graph (DAG): A DAG is a graph with directed edges that form no cycle. A node may still have multiple predecessorscycle. A node may still have multiple predecessors

When programming graphs, it is convenient to add fields to the node type for When programming graphs, it is convenient to add fields to the node type for additional functions; e.g. it is possible to process all nodes in a linear fashion additional functions; e.g. it is possible to process all nodes in a linear fashion by adding a link field, etc.by adding a link field, etc.

Sample 1: build a stack of nodes of all nodes in G Sample 2: a step may have to traverse all nodes in G, though G is unconnected!

Page 4: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

4

Building a Graph

Page 5: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

5

Graph Data StructureA graph G( v, e ) consists of v nodes (AKA vertices) and A graph G( v, e ) consists of v nodes (AKA vertices) and

edges e that connect nodesedges e that connect nodes Implemented via some node_type data structure

G is identified and thus accessible via one select node, G is identified and thus accessible via one select node, called an called an entry nodeentry node, or simply entry, AKA , or simply entry, AKA headhead

Head is of type Head is of type pointer topointer to node_typenode_type

G is not necessarily connectedG is not necessarily connected If parts of G are unconnected, how can they be retrieved in

case of complete graph traversal?

Several methods of forcing complete access:Several methods of forcing complete access: Either create a super-node, not specified by the user of G, in a

way that each unconnected region is pointed at Or have a linked-list (LL) meandering through each node of G,

without this link field being part of G proper

Page 6: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

6

Sample Graph G0

1

R

2

Y

3

R

5

R 4O

Y

6

G0

How many How many Strongly Connected ComponentsStrongly Connected Components in G in G00? ?

Page 7: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

7

Graph Data StructureDDdd

Sample Graph GSample Graph G00 above has 6 nodes above has 6 nodes

The ID, AKA The ID, AKA namename of each node is shown next to the of each node is shown next to the nodes, e.g. 1 2 3 4 5 …nodes, e.g. 1 2 3 4 5 …

The graph’s node type data structure includes such The graph’s node type data structure includes such name information as part of name information as part of node_typenode_type

In addition, each node in GIn addition, each node in G00 has attributes, such as R, has attributes, such as R, G, Y etc. in the sample aboveG, Y etc. in the sample above

There may be many more attributes belonging to each There may be many more attributes belonging to each node, depending on what the graph will be used fornode, depending on what the graph will be used for

Any of these attributes must also declared in the Any of these attributes must also declared in the node_typenode_type data structure data structure

And the successors, if any, of each node must be And the successors, if any, of each node must be encoded in the node somehow; no limit on number!encoded in the node somehow; no limit on number!

GG00 has 3 SCCs; 2 of those are not interesting! has 3 SCCs; 2 of those are not interesting!

Page 8: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

8

Graph Data StructureDDdd

Since in general there is no inherent upper bound on Since in general there is no inherent upper bound on the number of successor nodes, a suitable way to the number of successor nodes, a suitable way to define successors is via a linked listdefine successors is via a linked list

Hence the data type for successor is a pointer to a Hence the data type for successor is a pointer to a linked list of link nodeslinked list of link nodes

Link nodes then are also allocated off the heap, as Link nodes then are also allocated off the heap, as needed, of type needed, of type link_typelink_type

And each link consists of just 2 fieldsAnd each link consists of just 2 fields One field pointing to the next link; the type is pointer to link_type, in some languages expresses as *link_type

The other field pointing to the successor node; the type is pointer to node_type

For convenience, the last link inserted is added at the For convenience, the last link inserted is added at the start of the list, saving multiple searches for list endstart of the list, saving multiple searches for list end

Page 9: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

9

Graph Data Structure, Link// node may have any number of successors// node may have any number of successors// all need to be retrieved,// all need to be retrieved,// so each node has link,// so each node has link,// pointing to LL of all successor nodes.// pointing to LL of all successor nodes.// Last one connected is the first one inserted// Last one connected is the first one inserted

typedef struct link_tp * link_ptr_tp; // forward ref!typedef struct link_tp * link_ptr_tp; // forward ref!

typedef struct link_tptypedef struct link_tp{{

link_ptr_tplink_ptr_tp next_link;next_link; // point to next successor// point to next successornode_ptr_tpnode_ptr_tp next_node;next_node; // is a successor// is a successor

} str_link_tp;} str_link_tp;

#define LINK_SIZE sizeof( str_link_tp )#define LINK_SIZE sizeof( str_link_tp )

Page 10: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

10

Graph Data Structure, Node// "name" is arbitrary number given during creation// "name" is arbitrary number given during creation// "link" is head of LList of successor nodes, while// "link" is head of LList of successor nodes, while// finger" is linear link through all// finger" is linear link through all// "visited" true if was visited; initially FALSE// "visited" true if was visited; initially FALSEtypedef struct node_tp * node_ptr_tp;typedef struct node_tp * node_ptr_tp; typedef struct node_tptypedef struct node_tp{{

link_ptr_tplink_ptr_tp link;link; // points to LL of successors// points to LL of successorsnode_ptr_tpnode_ptr_tp finger;finger; // finger through all nodes// finger through all nodesintint name;name; // name given at creation// name given at creationboolbool visited; visited; // to check connectivity// to check connectivityothers ...others ... // many other fields// many other fields

} str_node_tp;} str_node_tp;

#define NODE_SIZE sizeof( str_node_tp )#define NODE_SIZE sizeof( str_node_tp )

Page 11: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

11

Building a Graph// similar to what you did for differentiation:// similar to what you did for differentiation:// create node in graph. Identified by name;// create node in graph. Identified by name;// connect to finger at start of Llist// connect to finger at start of Llistnode_ptr_tp make_node( int name )node_ptr_tp make_node( int name ){ // make_node{ // make_node

node_ptr_tp node = (node_ptr_tp) malloc( NODE_SIZE );node_ptr_tp node = (node_ptr_tp) malloc( NODE_SIZE );

// checked non-Null here, not later on user side!// checked non-Null here, not later on user side!ASSERT( node, "space for node missing" );ASSERT( node, "space for node missing" );node->fingernode->finger = finger; = finger;node->lowlinknode->lowlink = NIL;= NIL;node->numbernode->number = NIL; = NIL;node->linknode->link = NULL; = NULL;node->namenode->name = name; = name;node->visitednode->visited = FALSE;= FALSE;

return node;return node;} //end make_node} //end make_node

Page 12: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

12

Building a Graph// input is list of pairs, each element is a node name// input is list of pairs, each element is a node name// craft edge from first to second name/number// craft edge from first to second name/number// first and second are node pointers, initially NULL// first and second are node pointers, initially NULLwhile( scanf( "%d%d", &a, &b ) ) { // a, b are intswhile( scanf( "%d%d", &a, &b ) ) { // a, b are ints

if ( ! ( first = exists( a ) ) ) {if ( ! ( first = exists( a ) ) ) {first = make_node( a );first = make_node( a );} //end if} //end ifif ( ! ( second = exists( b ) ) ) {if ( ! ( second = exists( b ) ) ) {second = make_node( b );second = make_node( b );} //end if} //end if

// now both exist. Either created, or pre-existed:// now both exist. Either created, or pre-existed:// Connect them!// Connect them!

if ( new_link( first, second ) ) {if ( new_link( first, second ) ) {link = make_link( first->link, second );link = make_link( first->link, second );ASSERT( link, "no space for link node" );ASSERT( link, "no space for link node" );first->link = link;first->link = link;}else{}else{// link was there already, no ned to add again!// link was there already, no ned to add again!printf( "<><> skip duplicate link %d->%d\n", a, b );printf( "<><> skip duplicate link %d->%d\n", a, b );} //end if} //end if

} //end while} //end while

Page 13: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

13

Building a Graph

// check, whether link between these 2 nodes already exists// check, whether link between these 2 nodes already exists// if not, return true: New! Else return false, NOT new// if not, return true: New! Else return false, NOT newbool new_link( node_ptr_tp first, node_ptr_tp second )bool new_link( node_ptr_tp first, node_ptr_tp second ){ // new_link{ // new_link

int targetint target = second->name;= second->name;link_ptr_tp linklink_ptr_tp link = first->link;= first->link;

while ( link ) {while ( link ) {if ( target == link->next_node->name ) {if ( target == link->next_node->name ) {

return FALSE; // it is an existing link, NOT newreturn FALSE; // it is an existing link, NOT new} //end if} //end if// check different node// check different nodelink = link->next_link;link = link->next_link;

} //end while} //end while// none of successors equal the second node's name// none of successors equal the second node's namereturn TRUE; // is a new linkreturn TRUE; // is a new link

} //end new_link} //end new_link

Page 14: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

14

Strongly Connected Components

Page 15: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

15

Strongly Connected ComponentWe’ll analyze graphs for the attribute of We’ll analyze graphs for the attribute of strong connectivitystrong connectivity

Using the best method known to date: by Robert E Tarjan, in his Using the best method known to date: by Robert E Tarjan, in his awesome 1972 SIAM paper: The beauty in Computer Science awesome 1972 SIAM paper: The beauty in Computer Science

Requires special fields in graph node, Requires special fields in graph node, int number int number and and int int lowlinklowlink, which we just add to regular node, which we just add to regular node

typedef struct node_tptypedef struct node_tp{{

link_ptr_tplink_ptr_tp link;link; // points to LL of successors// points to LL of successorsnode_ptr_tpnode_ptr_tp finger;finger; // finger through all nodes// finger through all nodesintint lowlink;lowlink; // Tarjan's lowlink// Tarjan's lowlinkintint number;number; // Tarjan's number// Tarjan's numberintint name;name; // name given during creation// name given during creationboolbool visited;visited; // to check connectivity// to check connectivity

} str_node_tp;} str_node_tp;

#define NODE_SIZE sizeof( str_node_tp )#define NODE_SIZE sizeof( str_node_tp )

Page 16: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

16

Strongly Connected ComponentEvery node vEvery node vii in a strongly connected component (SCC) in a strongly connected component (SCC)

of graph G can reach every node vof graph G can reach every node vii --not necessarily --not necessarily in a single stepin a single step

An SCC is a subgraph SG of graph G, SG An SCC is a subgraph SG of graph G, SG ⊆⊆ G G

By definition then, a singleton node graph is strongly By definition then, a singleton node graph is strongly connected; not very interesting, but this shows up connected; not very interesting, but this shows up when we discuss Tarjan’s method to uncover SCCswhen we discuss Tarjan’s method to uncover SCCs

We’ll enhance Tarjan’s code to filter out singleton-node We’ll enhance Tarjan’s code to filter out singleton-node SCCsSCCs

It is not required that an SCC have a single entry point, It is not required that an SCC have a single entry point, single exit point, and a single back-edgesingle exit point, and a single back-edge

Graph needs defined entry point: entry or headGraph needs defined entry point: entry or head

Tarjan’s SCC analysis may start at any node of GTarjan’s SCC analysis may start at any node of G

Proof for correct working of algorithm in [3], Tarjan’s Proof for correct working of algorithm in [3], Tarjan’s awesome 1972 paperawesome 1972 paper

Page 17: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

17

Strongly Connected Component

// Pseudo code for Tarjan’s method// Pseudo code for Tarjan’s method// of detecting SCCs in directed graph// of detecting SCCs in directed graphint scc_number = 0int scc_number = 0

procedure main()procedure main(){ // main{ // main

scc_number := 0scc_number := 0empty the stackempty the stackmark all nodes in G as 'not visited'mark all nodes in G as 'not visited'for each node w, w for each node w, w ϵϵ G not visited, doG not visited, do

scc( w )scc( w )end forend for

} // end main} // end main

Page 18: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

18

Strongly Connected Component// Pseudo code for Tarjan’s method of detecting SCCs in directed graph// Pseudo code for Tarjan’s method of detecting SCCs in directed graph// Node in Tarjan's notation has added lowlink and number// Node in Tarjan's notation has added lowlink and number// Also, there is a stack of nodes, again encoded via field and scc_stack// Also, there is a stack of nodes, again encoded via field and scc_stackprocedure scc( node_ptr_tp v )procedure scc( node_ptr_tp v ){ // scc{ // scc

lowlink( v ) := number( v ) := ++scc_numberlowlink( v ) := number( v ) := ++scc_numberpush( v )push( v )for all successors w of v dofor all successors w of v do

if w is not visited then if w is not visited then -- v->w is a tree arc-- v->w is a tree arcscc( w )scc( w )lowlink( v ) := min( lowlink( v ), lowlink( w ) )lowlink( v ) := min( lowlink( v ), lowlink( w ) )

elsif number( w ) < number( v ) thenelsif number( w ) < number( v ) then -- v->w is a cross link-- v->w is a cross linkif in_stack( w ) thenif in_stack( w ) then

lowlink( v ) := min( lowlink( v ), number( w ) )lowlink( v ) := min( lowlink( v ), number( w ) )end ifend if

end ifend ifend forend forif lowlink( v ) = number( v ) thenif lowlink( v ) = number( v ) then -- next scc found-- next scc found

scc_count++scc_count++while scc_stack, w := scc_stack, number( w ) >= number( v ) dowhile scc_stack, w := scc_stack, number( w ) >= number( v ) do

-- w is part of this scc_number-- w is part of this scc_numberpop( w )pop( w )

end whileend whileend ifend if

} // end scc} // end scc

Page 19: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

19

3

2

1

10

9

5

4

8

7

6

13

11 12

14

SCC4

SCC3

SCC2

SCC1

SCC Sample – Omit Trivial SCCs

Page 20: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

20

3Num:Low:Stack:

2Num:Low:Stack:

1Num:Low:Stack:

3-Node SCC Sample

Page 21: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

21

Outside call to Outside call to scc( for node 1 )scc( for node 1 ) Increments num to 1, sets fields .num and .lowlink = 1 Pushes node 1, i.e., stack = 1, node 1’s predecessor = null Recursive call to find_scc( for node 2 ) When done, find that lowlink = num, hence SCC

Recursive call Recursive call scc( node 2 )scc( node 2 ) Set node 2’s .num and .lowlink = 2 Stack points to node 2, node 2.pred is node 1 Has 2 successors: node 1 and node 3 But node 1 is visited, while node 3 causes new find_scc( node 3 )

Recursive call Recursive call scc( node 3 )scc( node 3 ) Set .num and .lowlink = 3 Stack points to node 3, node 3.pred is node 2 Has no successor But lowlink = num hence is SCC, but is a singleton-node SCC

3-Node SCC Sample

Page 22: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

22

Strongly Connected Component//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////// //////////////////////// S C C G r a p h A n a l y s i s //////////////////////// S C C G r a p h A n a l y s i s //////////////////////// //////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// globals for scc// globals for sccintint scc_numberscc_number = NIL;= NIL; // Tarjan's SCC numbers// Tarjan's SCC numbersnode_ptr_tpnode_ptr_tp scc_stackscc_stack = NULL;= NULL; // stack exists via link in nodes// stack exists via link in nodesintint scc_countscc_count = 0;= 0; // tracks # of SCCs// tracks # of SCCs

// initial point of stack is global "scc_stack"// initial point of stack is global "scc_stack"// each node has scc_pred link, linking up in fashion of a stack// each node has scc_pred link, linking up in fashion of a stackvoid push( node_ptr_tp v )void push( node_ptr_tp v ){ // push{ // push

ASSERT( v, "push() called with NIL vertex v" );ASSERT( v, "push() called with NIL vertex v" );ASSERT( !( v->visited ), "pushing vertex again?" );ASSERT( !( v->visited ), "pushing vertex again?" );v->scc_predv->scc_pred = scc_stack;= scc_stack; // first time NULL, then stack ptr// first time NULL, then stack ptrv->visitedv->visited = TRUE;= TRUE; // will be handled now// will be handled nowscc_stackscc_stack = v;= v; // global pts ID’s head// global pts ID’s head

} //end push} //end push

// starting with global scc_stack, we can traverse whole stack// starting with global scc_stack, we can traverse whole stack// all elements are connected by node field scc_stack// all elements are connected by node field scc_stackvoid pop()void pop(){ // pop{ // pop

ASSERT( scc_stack, "error, empty SCC stack" );ASSERT( scc_stack, "error, empty SCC stack" );scc_stack->visited scc_stack->visited = FALSE;= FALSE;scc_stack scc_stack = scc_stack->scc_pred;= scc_stack->scc_pred;

} //end pop} //end pop

Page 23: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

23

SCC Coded, Part 1void scc( node_ptr_tp v )void scc( node_ptr_tp v ){ // scc{ // scc

node_ptr_tp w;node_ptr_tp w;

ASSERT( v, "calling scc with NULL pointer" );ASSERT( v, "calling scc with NULL pointer" );ASSERT( !v->number, “node already has non-null number!" );ASSERT( !v->number, “node already has non-null number!" );v->number = v->lowlink = ++scc_number;v->number = v->lowlink = ++scc_number;push( v );push( v );for( link_ptr_tp link=v->link; link; link=link->next_link ) for( link_ptr_tp link=v->link; link; link=link->next_link ) {{

w = link->next_node;w = link->next_node;ASSERT( w, “node w linked as successor must be /= 0" );ASSERT( w, “node w linked as successor must be /= 0" );if ( ! w->number ) {if ( ! w->number ) {

scc( w );scc( w );v->lowlink = min( v->lowlink, w->lowlink );v->lowlink = min( v->lowlink, w->lowlink );

}else if ( w->number < v->number ) {}else if ( w->number < v->number ) {// frond, AKA cross link// frond, AKA cross linkif( w->visited ) {if( w->visited ) {

v->lowlink = min( v->lowlink, w->number );v->lowlink = min( v->lowlink, w->number );} //end if} //end if

} //end if} //end if} //end for} //end for. . Continued next page: now we can pop . . Continued next page: now we can pop

Page 24: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

24

SCC Coded, Part 2// now pop up all SCCs// now pop up all SCCsif ( v->lowlink == v->number ) {if ( v->lowlink == v->number ) {

// found next scc; but if singleton node scc: skip it// found next scc; but if singleton node scc: skip itif ( scc_stack == v ) {if ( scc_stack == v ) {

// yes, singleton node// yes, singleton nodepop();pop();

}else{}else{// multi-node scc; THAT we do consider// multi-node scc; THAT we do considerscc_count++;scc_count++;while( scc_stack && ( scc_stack->number >= v->number ) ) {while( scc_stack && ( scc_stack->number >= v->number ) ) {

printf( "%d scc %d\n", scc_stack->name, scc_count );printf( "%d scc %d\n", scc_stack->name, scc_count );pop();pop();

} //end while} //end while} //end if} //end if

} //end if} //end if} //end scc} //end scc

Page 25: 1 CS 410 Mastery in Programming Chapter 6 Graphs, Focus: Strongly Connected Components Herbert G. Mayer, PSU CS status 7/25/2011

25

References1.1. Control Flow Graph, in: Control Flow Graph, in: Mayer, H. Mayer, H. ““Parallel Parallel

Execution Enabled by Refined Source Analysis: Execution Enabled by Refined Source Analysis: Cost and Benefits in a Supercompiler”Cost and Benefits in a Supercompiler”, R. , R. Oldenbourg Verlag München/Wien, March 1997 Oldenbourg Verlag München/Wien, March 1997

2.2. Graphs in: Graphs in: C. Berge, “Graphs and Hypergraphs”, C. Berge, “Graphs and Hypergraphs”, North-Holland, Amsterdam 1973North-Holland, Amsterdam 1973

3.3. SCCs: Robert Tarjan,SCCs: Robert Tarjan, "Depth-First Search and Linear "Depth-First Search and Linear Graph Algorithms"Graph Algorithms". SIAM J. Computing, Vol. 1, No. . SIAM J. Computing, Vol. 1, No. 2, June 19722, June 1972