1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- This document was generated using DocBuilder 3.3.3 -->
<HTML>
<HEAD>
<TITLE>digraph</TITLE>
<SCRIPT type="text/javascript" src="../../../../doc/erlresolvelinks.js">
</SCRIPT>
<STYLE TYPE="text/css">
<!--
.REFBODY { margin-left: 13mm }
.REFTYPES { margin-left: 8mm }
-->
</STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#FF00FF"
ALINK="#FF0000">
<!-- refpage -->
<CENTER>
<A HREF="http://www.erlang.se">
<IMG BORDER=0 ALT="[Ericsson AB]" SRC="min_head.gif">
</A>
<H1>digraph</H1>
</CENTER>
<H3>MODULE</H3>
<DIV CLASS=REFBODY>
digraph
</DIV>
<H3>MODULE SUMMARY</H3>
<DIV CLASS=REFBODY>
Directed Graphs
</DIV>
<H3>DESCRIPTION</H3>
<DIV CLASS=REFBODY>
<P>The <CODE>digraph</CODE> module implements a version of labeled
directed graphs. What makes the graphs implemented here
non-proper directed graphs is that multiple edges between
vertices are allowed. However, the customary definition of
directed graphs will be used in the text that follows.
<P>A <A NAME="digraph"><!-- Empty --></A><STRONG>directed graph</STRONG> (or just
"digraph") is a pair (V,E) of a finite set V of <A NAME="vertex"><!-- Empty --></A><STRONG>vertices</STRONG> and a finite set E of <A NAME="edge"><!-- Empty --></A><STRONG>directed edges</STRONG> (or just "edges"). The set of
edges E is a subset of VנV (the Cartesian
product of V with itself). In this module, V is allowed to be
empty; the so obtained unique digraph is called the <A NAME="empty_digraph"><!-- Empty --></A> <STRONG>empty digraph</STRONG>. Both vertices and
edges are represented by unique Erlang terms.
<P>Digraphs can be annotated with additional information. Such
information may be attached to the vertices and to the edges of
the digraph. A digraph which has been annotated is called a
<STRONG>labeled digraph</STRONG>, and the information attached to a
vertex or an edge is called a <A NAME="label"><!-- Empty --></A><STRONG>label</STRONG>.
Labels are Erlang terms.
<P>An edge e=(v,w) is said to <A NAME="emanate"><!-- Empty --></A><STRONG>emanate</STRONG> from vertex v and to be <A NAME="incident"><!-- Empty --></A><STRONG>incident</STRONG> on vertex w. The <A NAME="out_degree"><!-- Empty --></A><STRONG>out-degree</STRONG> of a vertex is the number of
edges emanating from that vertex. The <A NAME="in_degree"><!-- Empty --></A><STRONG>in-degree</STRONG> of a vertex is the number of
edges incident on that vertex. If there is an edge emanating
from v and incident on w, then w is is said to be an <A NAME="out_neighbour"><!-- Empty --></A><STRONG>out-neighbour</STRONG> of v, and v is said to
be an <A NAME="in_neighbour"><!-- Empty --></A><STRONG>in-neighbour</STRONG> of w. A
<A NAME="path"><!-- Empty --></A><STRONG>path</STRONG> P from v[1] to v[k] in a digraph
(V, E) is a non-empty sequence
v[1],v[2],...,v[k] of vertices in V such that
there is an edge (v[i],v[i+1]) in E for
1<=i<k. The <A NAME="length"><!-- Empty --></A><STRONG>length</STRONG> of the path P is k-1. P is <A NAME="simple_path"><!-- Empty --></A><STRONG>simple</STRONG> if all vertices are distinct,
except that the first and the last vertices may be the same. P
is a <A NAME="cycle"><!-- Empty --></A><STRONG>cycle</STRONG> if the length of P is not
zero and v[1] = v[k]. A <A NAME="loop"><!-- Empty --></A><STRONG>loop</STRONG> is a
cycle of length one. A <A NAME="simple_cycle"><!-- Empty --></A><STRONG>simple
cycle</STRONG> is a path that is both a cycle and simple. An <A NAME="acyclic_digraph"><!-- Empty --></A><STRONG>acyclic digraph</STRONG> is a digraph that
has no cycles.
</DIV>
<H3>EXPORTS</H3>
<P><A NAME="add_edge/5"><STRONG><CODE>add_edge(G, E, V1, V2, Label) -> edge() | {error, Reason}</CODE></STRONG></A><BR>
<A NAME="add_edge/4"><STRONG><CODE>add_edge(G, V1, V2, Label) -> edge() | {error, Reason}</CODE></STRONG></A><BR>
<A NAME="add_edge/3"><STRONG><CODE>add_edge(G, V1, V2) -> edge() | {error, Reason}</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>E = edge()</CODE></STRONG><BR>
<STRONG><CODE>V1 = V2 = vertex()</CODE></STRONG><BR>
<STRONG><CODE>Label = label()</CODE></STRONG><BR>
<STRONG><CODE>Reason = {bad_edge, Path} | {bad_vertex, V}</CODE></STRONG><BR>
<STRONG><CODE>Path = [vertex()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P><CODE>add_edge/5</CODE> creates (or modifies) the edge <CODE>E</CODE>
of the digraph <CODE>G</CODE>, using <CODE>Label</CODE> as the (new)
<A HREF="#label">label</A> of the edge. The
edge is <A HREF="#emanate">emanating</A> from
<CODE>V1</CODE> and <A HREF="#incident">incident</A>
on <CODE>V2</CODE>. Returns <CODE>E</CODE>.
<P><CODE>add_edge(G,V1,V2,Label)</CODE> is
equivalent to
<CODE>add_edge(G,E,V1,V2,Label)</CODE>,
where <CODE>E</CODE> is a created edge. Tuples on the form
<CODE>['$e'|N]</CODE>, where N is an
integer>=1, are used for representing the
created edges.
<P><CODE>add_edge(G,V1,V2)</CODE> is equivalent to
<CODE>add_edge(G,V1,V2,[])</CODE>.
<P>If the edge would create a cycle in an <A HREF="#acyclic_digraph">acyclic digraph</A>, then
<CODE>{error,{bad_edge,Path}}</CODE> is returned. If
either of <CODE>V1</CODE> or <CODE>V2</CODE> is not a vertex of the
digraph <CODE>G</CODE>, then
<CODE>{error,{bad_vertex,</CODE>V<CODE>}}</CODE> is
returned, V=<CODE>V1</CODE> or
V=<CODE>V2</CODE>.
</DIV>
<P><A NAME="add_vertex/3"><STRONG><CODE>add_vertex(G, V, Label) -> vertex()</CODE></STRONG></A><BR>
<A NAME="add_vertex/2"><STRONG><CODE>add_vertex(G, V) -> vertex()</CODE></STRONG></A><BR>
<A NAME="add_vertex/1"><STRONG><CODE>add_vertex(G) -> vertex()</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>V = vertex()</CODE></STRONG><BR>
<STRONG><CODE>Label = label()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P><CODE>add_vertex/3</CODE> creates (or modifies) the vertex <CODE>V</CODE>
of the digraph <CODE>G</CODE>, using <CODE>Label</CODE> as the (new)
<A HREF="#label">label</A> of the
vertex. Returns <CODE>V</CODE>.
<P><CODE>add_vertex(G,V)</CODE> is equivalent to
<CODE>add_vertex(G,V,[])</CODE>.
<P><CODE>add_vertex/1</CODE> creates a vertex using the empty list
as label, and returns the created vertex. Tuples on the form
<CODE>['$v'|N]</CODE>, where N is an
integer>=1, are used for representing the
created vertices.
</DIV>
<P><A NAME="del_edge/2"><STRONG><CODE>del_edge(G, E) -> true</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>E = edge()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Deletes the edge <CODE>E</CODE> from the digraph <CODE>G</CODE>.
</DIV>
<P><A NAME="del_edges/2"><STRONG><CODE>del_edges(G, Edges) -> true</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>Edges = [edge()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Deletes the edges in the list <CODE>Edges</CODE> from the digraph
<CODE>G</CODE>.
</DIV>
<P><A NAME="del_path/3"><STRONG><CODE>del_path(G, V1, V2) -> true</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>V1 = V2 = vertex()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Deletes edges from the digraph <CODE>G</CODE> until there are no
<A HREF="#path">paths</A> from the vertex
<CODE>V1</CODE> to the vertex <CODE>V2</CODE>.
<P>A sketch of the procedure employed: Find an arbitrary
<A HREF="#simple_path">simple path</A>
v[1],v[2],...,v[k] from <CODE>V1</CODE> to
<CODE>V2</CODE> in <CODE>G</CODE>. Remove all edges of <CODE>G</CODE> <A HREF="#emanate">emanating</A> from v[i] and <A HREF="#incident">incident</A> to v[i+1] for
1<=i<k (including multiple
edges). Repeat until there is no path between <CODE>V1</CODE> and
<CODE>V2</CODE>.
</DIV>
<P><A NAME="del_vertex/2"><STRONG><CODE>del_vertex(G, V) -> true</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>V = vertex()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Deletes the vertex <CODE>V</CODE> from the digraph <CODE>G</CODE>. Any
edges <A HREF="#emanate">emanating</A> from
<CODE>V</CODE> or <A HREF="#incident">incident</A>
on <CODE>V</CODE> are also deleted.
</DIV>
<P><A NAME="del_vertices/2"><STRONG><CODE>del_vertices(G, Vertices) -> true</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>Vertices = [vertex()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Deletes the vertices in the list <CODE>Vertices</CODE> from the
digraph <CODE>G</CODE>.
</DIV>
<P><A NAME="delete/1"><STRONG><CODE>delete(G) -> true</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Deletes the digraph <CODE>G</CODE>. This call is important
because digraphs are implemented with <CODE>Ets</CODE>. There is
no garbage collection of <CODE>Ets</CODE> tables. The digraph
will, however, be deleted if the process that created the
digraph terminates.
</DIV>
<P><A NAME="edge/2"><STRONG><CODE>edge(G, E) -> {E, V1, V2, Label} | false</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>E = edge()</CODE></STRONG><BR>
<STRONG><CODE>V1 = V2 = vertex()</CODE></STRONG><BR>
<STRONG><CODE>Label = label()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns <CODE>{E,V1,V2,Label}</CODE> where
<CODE>Label</CODE> is the <A HREF="#label">label</A>
of the edge <CODE>E</CODE> <A HREF="#emanate">emanating</A> from <CODE>V1</CODE> and
<A HREF="#incident">incident</A> on <CODE>V2</CODE>
of the digraph <CODE>G</CODE>. If there is no edge <CODE>E</CODE> of the
digraph <CODE>G</CODE>, then <CODE>false</CODE> is returned.
</DIV>
<P><A NAME="edges/1"><STRONG><CODE>edges(G) -> Edges</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>Edges = [edge()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns a list of all edges of the digraph <CODE>G</CODE>, in
some unspecified order.
</DIV>
<P><A NAME="edges/2"><STRONG><CODE>edges(G, V) -> Edges</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>V = vertex()</CODE></STRONG><BR>
<STRONG><CODE>Edges = [edge()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns a list of all edges <A HREF="#emanate">emanating</A> from or <A HREF="#incident">incident</A> on <CODE>V</CODE> of the
digraph <CODE>G</CODE>, in some unspecified order.
</DIV>
<P><A NAME="get_cycle/2"><STRONG><CODE>get_cycle(G, V) -> Vertices | false</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>V1 = V2 = vertex()</CODE></STRONG><BR>
<STRONG><CODE>Vertices = [vertex()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>If there is a <A HREF="#simple_cycle">simple
cycle</A> of length two or more through the vertex
<CODE>V</CODE>, then the cycle is returned as a list
<CODE>[V,...,V]</CODE> of vertices, otherwise if there
is a <A HREF="#loop">loop</A> through
<CODE>V</CODE>, then the loop is returned as a list <CODE>[V]</CODE>. If
there are no cycles through <CODE>V</CODE>, then <CODE>false</CODE> is
returned.
<P><CODE>get_path/3</CODE> is used for finding a simple cycle
through <CODE>V</CODE>.
</DIV>
<P><A NAME="get_path/3"><STRONG><CODE>get_path(G, V1, V2) -> Vertices | false</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>V1 = V2 = vertex()</CODE></STRONG><BR>
<STRONG><CODE>Vertices = [vertex()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Tries to find a <A HREF="#simple_path">simple
path</A> from the vertex <CODE>V1</CODE> to the vertex
<CODE>V2</CODE> of the digraph <CODE>G</CODE>. Returns the path as a
list <CODE>[V1,...,V2]</CODE> of vertices, or
<CODE>false</CODE> if no simple path from <CODE>V1</CODE> to <CODE>V2</CODE>
of length one or more exists.
<P>The digraph <CODE>G</CODE> is traversed in a depth-first manner,
and the first path found is returned.
</DIV>
<P><A NAME="get_short_cycle/2"><STRONG><CODE>get_short_cycle(G, V) -> Vertices | false</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>V1 = V2 = vertex()</CODE></STRONG><BR>
<STRONG><CODE>Vertices = [vertex()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Tries to find an as short as possible <A HREF="#simple_cycle">simple cycle</A> through the
vertex <CODE>V</CODE> of the digraph <CODE>G</CODE>. Returns the cycle
as a list <CODE>[V,...,V]</CODE> of vertices, or
<CODE>false</CODE> if no simple cycle through <CODE>V</CODE> exists.
Note that a <A HREF="#loop">loop</A> through
<CODE>V</CODE> is returned as the list <CODE>[V,V]</CODE>.
<P><CODE>get_short_path/3</CODE> is used for finding a simple cycle
through <CODE>V</CODE>.
</DIV>
<P><A NAME="get_short_path/3"><STRONG><CODE>get_short_path(G, V1, V2) -> Vertices | false</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>V1 = V2 = vertex()</CODE></STRONG><BR>
<STRONG><CODE>Vertices = [vertex()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Tries to find an as short as possible <A HREF="#simple_path">simple path</A> from the vertex
<CODE>V1</CODE> to the vertex <CODE>V2</CODE> of the digraph <CODE>G</CODE>.
Returns the path as a list <CODE>[V1,...,V2]</CODE> of
vertices, or <CODE>false</CODE> if no simple path from <CODE>V1</CODE>
to <CODE>V2</CODE> of length one or more exists.
<P>The digraph <CODE>G</CODE> is traversed in a breadth-first
manner, and the first path found is returned.
</DIV>
<P><A NAME="in_degree/2"><STRONG><CODE>in_degree(G, V) -> integer()</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G= digraph()</CODE></STRONG><BR>
<STRONG><CODE>V = vertex()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns the <A HREF="#in_degree">in-degree</A> of the vertex
<CODE>V</CODE> of the digraph <CODE>G</CODE>.
</DIV>
<P><A NAME="in_edges/2"><STRONG><CODE>in_edges(G, V) -> Edges</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>V = vertex()</CODE></STRONG><BR>
<STRONG><CODE>Edges = [edge()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns a list of all edges <A HREF="#incident">incident</A> on <CODE>V</CODE> of the
digraph <CODE>G</CODE>, in some unspecified order.
</DIV>
<P><A NAME="in_neighbours/2"><STRONG><CODE>in_neighbours(G, V) -> Vertices</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>V = vertex()</CODE></STRONG><BR>
<STRONG><CODE>Vertices = [vertex()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns a list of all <A HREF="#in_neighbour">in-neighbours</A> of <CODE>V</CODE>
of the digraph <CODE>G</CODE>, in some unspecified order.
</DIV>
<P><A NAME="info/1"><STRONG><CODE>info(G) -> InfoList</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>InfoList = [{cyclicity, Cyclicity}, {memory, NoWords},
{protection, Protection}]</CODE></STRONG><BR>
<STRONG><CODE>Cyclicity = cyclic | acyclic</CODE></STRONG><BR>
<STRONG><CODE>Protection = protected | private</CODE></STRONG><BR>
<STRONG><CODE>NoWords = integer() >= 0</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns a list of <CODE>{Tag, Value}</CODE> pairs describing the
digraph <CODE>G</CODE>. The following pairs are returned:
<P>
<UL>
<LI>
<CODE>{cyclicity, Cyclicity}</CODE>, where <CODE>Cyclicity</CODE>
is <CODE>cyclic</CODE> or <CODE>acyclic</CODE>, according to the
options given to <CODE>new</CODE>.
<BR>
</LI>
<LI>
<CODE>{memory, NoWords}</CODE>, where <CODE>NoWords</CODE> is
the number of words allocated to the <CODE>ets</CODE> tables.
<BR>
</LI>
<LI>
<CODE>{protection, Protection}</CODE>, where <CODE>Protection</CODE>
is <CODE>protected</CODE> or <CODE>private</CODE>, according
to the options given to <CODE>new</CODE>.
<BR>
</LI>
</UL>
</DIV>
<P><A NAME="new/0"><STRONG><CODE>new() -> digraph()</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY>
<P>Equivalent to <CODE>new([])</CODE>.
</DIV>
<P><A NAME="new/1"><STRONG><CODE>new(Type) -> digraph() | {error, Reason}</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>Type = [cyclic | acyclic | private | protected]</CODE></STRONG><BR>
<STRONG><CODE>Reason = {unknown_type, term()}</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns an <A HREF="#empty_digraph">empty
digraph</A> with properties according to the options
in <CODE>Type</CODE>:
<P>
<DL>
<DT>
<CODE>cyclic</CODE>
</DT>
<DD>
Allow <A HREF="#cycle">cycles</A> in the
digraph (default).
</DD>
<DT>
<CODE>acyclic</CODE>
</DT>
<DD>
The digraph is to be kept <A HREF="#acyclic_digraph">acyclic</A>.
</DD>
<DT>
<CODE>protected</CODE>
</DT>
<DD>
Other processes can read the digraph (default).
</DD>
<DT>
<CODE>private</CODE>
</DT>
<DD>
The digraph can be read and modified by the creating
process only.
</DD>
</DL>
<P>If an unrecognized type option T is given, then
<CODE>{error,{unknown_type,</CODE>T<CODE>}}</CODE> is
returned.
</DIV>
<P><A NAME="no_edges/1"><STRONG><CODE>no_edges(G) -> integer() >= 0</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns the number of edges of the digraph <CODE>G</CODE>.
</DIV>
<P><A NAME="no_vertices/1"><STRONG><CODE>no_vertices(G) -> integer() >= 0</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns the number of vertices of the digraph <CODE>G</CODE>.
</DIV>
<P><A NAME="out_degree/2"><STRONG><CODE>out_degree(G, V) -> integer()</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>V = vertex()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns the <A HREF="#out_degree">out-degree</A> of the vertex
<CODE>V</CODE> of the digraph <CODE>G</CODE>.
</DIV>
<P><A NAME="out_edges/2"><STRONG><CODE>out_edges(G, V) -> Edges</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>V = vertex()</CODE></STRONG><BR>
<STRONG><CODE>Edges = [edge()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns a list of all edges <A HREF="#emanate">emanating</A> from <CODE>V</CODE> of the
digraph <CODE>G</CODE>, in some unspecified order.
</DIV>
<P><A NAME="out_neighbours/2"><STRONG><CODE>out_neighbours(G, V) -> Vertices</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>V = vertex()</CODE></STRONG><BR>
<STRONG><CODE>Vertices = [vertex()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns a list of all <A HREF="#out_neighbour">out-neighbours</A> of <CODE>V</CODE>
of the digraph <CODE>G</CODE>, in some unspecified order.
</DIV>
<P><A NAME="vertex/2"><STRONG><CODE>vertex(G, V) -> {V, Label} | false</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>V = vertex()</CODE></STRONG><BR>
<STRONG><CODE>Label = label()</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns <CODE>{V,Label}</CODE> where <CODE>Label</CODE> is the
<A HREF="#label">label</A> of the vertex
<CODE>V</CODE> of the digraph <CODE>G</CODE>, or <CODE>false</CODE> if there
is no vertex <CODE>V</CODE> of the digraph <CODE>G</CODE>.
</DIV>
<P><A NAME="vertices/1"><STRONG><CODE>vertices(G) -> Vertices</CODE></STRONG></A><BR>
<DIV CLASS=REFBODY><P>Types:
<DIV CLASS=REFTYPES>
<P>
<STRONG><CODE>G = digraph()</CODE></STRONG><BR>
<STRONG><CODE>Vertices = [vertex()]</CODE></STRONG><BR>
</DIV>
</DIV>
<DIV CLASS=REFBODY>
<P>Returns a list of all vertices of the digraph <CODE>G</CODE>, in
some unspecified order.
</DIV>
<H3>See Also</H3>
<DIV CLASS=REFBODY>
<P><A HREF="digraph_utils.html">digraph_utils(3)</A>,
<A HREF="ets.html">ets(3)</A>
</DIV>
<H3>AUTHORS</H3>
<DIV CLASS=REFBODY>
Tony Rogvall - support@erlang.ericsson.se<BR>
</DIV>
<CENTER>
<HR>
<SMALL>stdlib 1.14.2<BR>
Copyright © 1991-2006
<A HREF="http://www.erlang.se">Ericsson AB</A><BR>
</SMALL>
</CENTER>
</BODY>
</HTML>
|