79 (number): Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
 
No edit summary
Line 1: Line 1:
[[Image:Simple cycle graph.svg|thumb|120px|This undirected cyclic graph can be described by the list {a,b}, {a,c}, {b,c}.]]


In [[graph theory]] and [[computer science]], an '''adjacency list''' representation of a [[graph (mathematics)|graph]] is a collection of unordered lists, one for each vertex in the graph. Each list describes the set of neighbors of its vertex.  See [[Sparse_matrix#Storing_a_sparse_matrix|Storing a sparse matrix]] for alternatives.


Each of the trophies from all among the members in your clan get added up and as well as divided by 2 find out your clans overall trophies. Playing many different kinds of games gets your gaming time more pleasant. and your league also determines any battle win bonus. 5 star rating and she is known to be very addictive as players can devote several hours experiencing the game. She centers on beauty salon business investment and client fascination.<br><br>Video gaming are fun to have fun with your kids. Aid you learn much more details your kid's interests. Sharing interests with children like this can will also create great conversations. It also gives you an opportunity to monitor increase of their skills.<br><br>Numerous games which have been created till now, clash of clans is preferred by many individuals. The game which requires players to create villages and characters to push forward can quite challenging at times. Players have to carry out side different tasks including raids and missions. May be very tough as well as players often get ensnared in one place. When this happens, it truly is quite frustrating. But nevertheless this can be influenced now because there is really a way out of this guidance.<br><br>Computing machine games offer entertaining - everybody, and they unquestionably are surely more complicated as compared Frogger was! Regarding get all you will be able to out of game titles, use the advice set in place out here. You are going to find any exciting new world inside of gaming, and you may likely wonder how you previously got by without one!<br><br>Provde the in-online game songs opportunity.  If you beloved this article and you simply would like to get more info with regards to clash of clans hack no survey ([http://circuspartypanama.com conversational tone]) nicely visit our own web-site. If, nonetheless, you might end annoyed by using it soon after one moment approximately, don't be worried to mute the telly or personal computer and play some audio of one's very own. You'll find a far more delightful game playing experience performing this and therefore are way more unlikely to get that you simply frustration from actively playing.<br><br>Casino is infiltrating houses everywhere. Some play these games for work, on the other hand others play them intended for enjoyment. This customers are booming and won't go away anytime soon. Read on for some fantastic tips about gaming.<br><br>Do not try to [http://Pinterest.com/search/pins/?q=eat+unhealthy eat unhealthy] food while in xbox on the internet actively playing time. This is a bad routine to gain associated with. Xbox game actively being is absolutely nothing similar to physical exercise, and all of that fast food will almost certainly only result in excessive fat. In the event you have to snack food, go with some thing wholesome to make online game actively performing times. The physical will thanks for it.
==Implementation details==
{|class="wikitable" align="right" style="width:18em;"
|colspan="3"|The graph pictured above has this adjacency list representation:
|-
|a|| adjacent to || b,c
|-
|b|| adjacent to || a,c
|-
|c|| adjacent to || a,b
|}
 
An adjacency list representation for a graph associates each vertex in the graph with the collection of its neighboring vertices or edges. There are many variations of this basic idea, differing in the details of how they implement the association between vertices and collections, in how they implement the collections, in whether they include both vertices and edges or only vertices as first class objects, and in what kinds of objects are used to represent the vertices and edges.
*An implementation suggested by [[Guido van Rossum]] uses a [[hash table]] to associate each vertex in a graph with an [[array data structure|array]] of adjacent vertices. In this representation, a vertex may be represented by any hashable object. There is no explicit representation of edges as objects.<ref>{{cite web
  | author = [[Guido van Rossum]]
  | year = 1998
  | title = Python Patterns — Implementing Graphs
  | url = http://www.python.org/doc/essays/graphs/}}</ref>
*Cormen et al. suggest an implementation in which the vertices are represented by index numbers.<ref>{{cite book
  | author = [[Thomas H. Cormen]], [[Charles E. Leiserson]], [[Ronald L. Rivest]], and [[Clifford Stein]]
  | title = [[Introduction to Algorithms]], Second Edition
  | publisher = MIT Press and McGraw-Hill
  | year = 2001
  | isbn = 0-262-03293-7
  | pages = 527–529 of section 22.1: Representations of graphs}}</ref> Their representation uses an array indexed by vertex number, in which the array cell for each vertex points to a [[singly linked list]] of the neighboring vertices of that vertex. In this representation, the nodes of the singly linked list may be interpreted as edge objects; however, they do not store the full information about each edge (they only store one of the two endpoints of the edge) and in undirected graphs there will be two different linked list nodes for each edge (one within the lists for each of the two endpoints of the edge).
*The [[object oriented]] '''incidence list''' structure suggested by Goodrich and Tamassia has special classes of vertex objects and edge objects. Each vertex object has an instance variable pointing to a collection object that lists the neighboring edge object. In turn, each edge object points to the two vertex objects at its endpoints.<ref name="A">{{cite book
  | author = [[Michael T. Goodrich]] and [[Roberto Tamassia]]
  | title = Algorithm Design: Foundations, Analysis, and Internet Examples
  | publisher = John Wiley & Sons
  | year = 2002
  | isbn = 0-471-38365-1}}</ref> This version of the adjacency list uses more memory than the version in which adjacent vertices are listed directly, but the existence of explicit edge objects allows it extra flexibility in storing additional information about edges.
 
{{clear}}
 
==Operations==
The main operation performed by the adjacency list data structure is to report a list of the neighbors of a given vertex. Using any of the implementations detailed above, this can be performed in constant time per neighbor. In other words, the total time to report all of the neighbors of a vertex ''v'' is proportional to the [[degree (graph theory)|degree]] of ''v''.
 
It is also possible, but not as efficient, to use adjacency lists to test whether an edge exists or does not exist between two specified vertices.  In an adjacency list in which the neighbors of each vertex are unsorted, testing for the existence of an edge may be performed in time proportional to the degree of one of the two given vertices, by using a [[sequential search]] through the neighbors of this vertex. If the neighbors are represented as a sorted array, [[binary search]] may be used instead, taking time proportional to the logarithm of the degree.
 
== Trade-offs ==
The main alternative to the adjacency list is the [[adjacency matrix]], a [[matrix (mathematics)|matrix]] whose rows and columns are indexed by vertices and whose cells contain a Boolean value that indicates whether an edge is present between the vertices corresponding to the row and column of the cell. For a [[sparse graph]] (one in which most pairs of vertices are not connected by edges) an adjacency list is significantly more space-efficient than an adjacency matrix (stored as an array): the space usage of the adjacency list is proportional to the number of edges and vertices in the graph, while for an adjacency matrix stored in this way the space is proportional to the square of the number of vertices. However, it is possible to store adjacency matrices more space-efficiently, matching the linear space usage of an adjacency list, by using a hash table indexed by pairs of vertices rather than an array.
 
The other significant difference between adjacency lists and adjacency matrices is in the efficiency of the operations they perform. In an adjacency list, the neighbors of each vertex may be listed efficiently, in time proportional to the degree of the vertex. In an adjacency matrix, this operation takes time proportional to the number of vertices in the graph, which may be significantly higher than the degree. On the other hand, the adjacency matrix allows testing whether two vertices are adjacent to each other in constant time; the adjacency list is slower to support this operation.
 
== Data Structures ==
 
For use as a data structure, the main alternative to the adjacency matrix is the adjacency list. Because each entry in the adjacency matrix requires only one bit, it can be represented in a very compact way, occupying only <math>|V|^2 / 8</math> bytes of contiguous space. Besides avoiding wasted space, this compactness encourages locality of reference.
 
However, for a sparse graph, adjacency lists require less storage space, because they do not waste any space to represent edges that are not present. Using a naïve array implementation on a 32-bit computer, an adjacency list for an undirected graph requires about <math>8 |E|</math> bytes of storage.
 
Noting that a simple graph can have at most <math>|V|^2</math> edges, allowing loops, we can let <math>d = |E| / |V|^2</math> denote the density of the graph. Then, <math>8 |E| > |V|^2 / 8</math>, or the adjacency list representation occupies more space precisely when <math>d > 1/64</math>. Thus a graph must be sparse indeed to justify an adjacency list representation.
 
Besides the space tradeoff, the different data structures also facilitate different operations. Finding all vertices adjacent to a given vertex in an adjacency list is as simple as reading the list. With an adjacency matrix, an entire row must instead be scanned, which takes <math>O(|V|)</math> time. Whether there is an edge between two given vertices can be determined at once with an adjacency matrix, while requiring time proportional to the minimum degree of the two vertices with the adjacency list.
 
== References ==
{{Reflist}}
 
== Additional reading ==
* {{cite web
  | author = [[David Eppstein]]
  | year = 1996
  | title = ICS 161 Lecture Notes: Graph Algorithms
  | url = http://www.ics.uci.edu/~eppstein/161/960201.html}}
 
== External links ==
* The [[Boost Graph Library]] implements an efficient [http://www.boost.org/doc/libs/1_43_0/libs/graph/doc/index.html adjacency list]
* [http://opendatastructures.org/versions/edition-0.1e/ods-java/12_2_AdjacencyLists_Graph_a.html Open Data Structures - Section 12.2 - AdjacencyList: A Graph as a Collection of Lists]
 
[[Category:Graph theory objects]]
[[Category:Graph data structures]]

Revision as of 23:59, 17 December 2013

File:Simple cycle graph.svg
This undirected cyclic graph can be described by the list {a,b}, {a,c}, {b,c}.

In graph theory and computer science, an adjacency list representation of a graph is a collection of unordered lists, one for each vertex in the graph. Each list describes the set of neighbors of its vertex. See Storing a sparse matrix for alternatives.

Implementation details

The graph pictured above has this adjacency list representation:
a adjacent to b,c
b adjacent to a,c
c adjacent to a,b

An adjacency list representation for a graph associates each vertex in the graph with the collection of its neighboring vertices or edges. There are many variations of this basic idea, differing in the details of how they implement the association between vertices and collections, in how they implement the collections, in whether they include both vertices and edges or only vertices as first class objects, and in what kinds of objects are used to represent the vertices and edges.

  • An implementation suggested by Guido van Rossum uses a hash table to associate each vertex in a graph with an array of adjacent vertices. In this representation, a vertex may be represented by any hashable object. There is no explicit representation of edges as objects.[1]
  • Cormen et al. suggest an implementation in which the vertices are represented by index numbers.[2] Their representation uses an array indexed by vertex number, in which the array cell for each vertex points to a singly linked list of the neighboring vertices of that vertex. In this representation, the nodes of the singly linked list may be interpreted as edge objects; however, they do not store the full information about each edge (they only store one of the two endpoints of the edge) and in undirected graphs there will be two different linked list nodes for each edge (one within the lists for each of the two endpoints of the edge).
  • The object oriented incidence list structure suggested by Goodrich and Tamassia has special classes of vertex objects and edge objects. Each vertex object has an instance variable pointing to a collection object that lists the neighboring edge object. In turn, each edge object points to the two vertex objects at its endpoints.[3] This version of the adjacency list uses more memory than the version in which adjacent vertices are listed directly, but the existence of explicit edge objects allows it extra flexibility in storing additional information about edges.

50 year old Petroleum Engineer Kull from Dawson Creek, spends time with interests such as house brewing, property developers in singapore condo launch and camping. Discovers the beauty in planing a trip to places around the entire world, recently only coming back from .

Operations

The main operation performed by the adjacency list data structure is to report a list of the neighbors of a given vertex. Using any of the implementations detailed above, this can be performed in constant time per neighbor. In other words, the total time to report all of the neighbors of a vertex v is proportional to the degree of v.

It is also possible, but not as efficient, to use adjacency lists to test whether an edge exists or does not exist between two specified vertices. In an adjacency list in which the neighbors of each vertex are unsorted, testing for the existence of an edge may be performed in time proportional to the degree of one of the two given vertices, by using a sequential search through the neighbors of this vertex. If the neighbors are represented as a sorted array, binary search may be used instead, taking time proportional to the logarithm of the degree.

Trade-offs

The main alternative to the adjacency list is the adjacency matrix, a matrix whose rows and columns are indexed by vertices and whose cells contain a Boolean value that indicates whether an edge is present between the vertices corresponding to the row and column of the cell. For a sparse graph (one in which most pairs of vertices are not connected by edges) an adjacency list is significantly more space-efficient than an adjacency matrix (stored as an array): the space usage of the adjacency list is proportional to the number of edges and vertices in the graph, while for an adjacency matrix stored in this way the space is proportional to the square of the number of vertices. However, it is possible to store adjacency matrices more space-efficiently, matching the linear space usage of an adjacency list, by using a hash table indexed by pairs of vertices rather than an array.

The other significant difference between adjacency lists and adjacency matrices is in the efficiency of the operations they perform. In an adjacency list, the neighbors of each vertex may be listed efficiently, in time proportional to the degree of the vertex. In an adjacency matrix, this operation takes time proportional to the number of vertices in the graph, which may be significantly higher than the degree. On the other hand, the adjacency matrix allows testing whether two vertices are adjacent to each other in constant time; the adjacency list is slower to support this operation.

Data Structures

For use as a data structure, the main alternative to the adjacency matrix is the adjacency list. Because each entry in the adjacency matrix requires only one bit, it can be represented in a very compact way, occupying only |V|2/8 bytes of contiguous space. Besides avoiding wasted space, this compactness encourages locality of reference.

However, for a sparse graph, adjacency lists require less storage space, because they do not waste any space to represent edges that are not present. Using a naïve array implementation on a 32-bit computer, an adjacency list for an undirected graph requires about 8|E| bytes of storage.

Noting that a simple graph can have at most |V|2 edges, allowing loops, we can let d=|E|/|V|2 denote the density of the graph. Then, 8|E|>|V|2/8, or the adjacency list representation occupies more space precisely when d>1/64. Thus a graph must be sparse indeed to justify an adjacency list representation.

Besides the space tradeoff, the different data structures also facilitate different operations. Finding all vertices adjacent to a given vertex in an adjacency list is as simple as reading the list. With an adjacency matrix, an entire row must instead be scanned, which takes O(|V|) time. Whether there is an edge between two given vertices can be determined at once with an adjacency matrix, while requiring time proportional to the minimum degree of the two vertices with the adjacency list.

References

43 year old Petroleum Engineer Harry from Deep River, usually spends time with hobbies and interests like renting movies, property developers in singapore new condominium and vehicle racing. Constantly enjoys going to destinations like Camino Real de Tierra Adentro.

Additional reading

External links

  1. Template:Cite web
  2. 20 year-old Real Estate Agent Rusty from Saint-Paul, has hobbies and interests which includes monopoly, property developers in singapore and poker. Will soon undertake a contiki trip that may include going to the Lower Valley of the Omo.

    My blog: http://www.primaboinca.com/view_profile.php?userid=5889534
  3. 20 year-old Real Estate Agent Rusty from Saint-Paul, has hobbies and interests which includes monopoly, property developers in singapore and poker. Will soon undertake a contiki trip that may include going to the Lower Valley of the Omo.

    My blog: http://www.primaboinca.com/view_profile.php?userid=5889534