For using igraph from Python
Home  Trees  Indices  Help 



object +  drawing.graph.VertexSeq +  VertexSeq
Class representing a sequence of vertices in the graph.
This class is most easily accessed by the vs
field of the
Graph object, which
returns an ordered sequence of all vertices in the graph. The vertex
sequence can be refined by invoking the VertexSeq.select() method. VertexSeq.select() can also be accessed by simply
calling the VertexSeq object.
An alternative way to create a vertex sequence referring to a given graph is to use the constructor directly:
>>> g = Graph.Full(3) >>> vs = VertexSeq(g) >>> restricted_vs = VertexSeq(g, [0, 1])
The individual vertices can be accessed by indexing the vertex sequence object. It can be used as an iterable as well, or even in a list comprehension:
>>> g=Graph.Full(3) >>> for v in g.vs: ... v["value"] = v.index ** 2 ... >>> [v["value"] ** 0.5 for v in g.vs] [0.0, 1.0, 2.0]
The vertex set can also be used as a dictionary where the keys are the attribute names. The values corresponding to the keys are the values of the given attribute for every vertex selected by the sequence.
>>> g=Graph.Full(3) >>> for idx, v in enumerate(g.vs): ... v["weight"] = idx*(idx+1) ... >>> g.vs["weight"] [0, 2, 6] >>> g.vs.select(1,2)["weight"] = [10, 20] >>> g.vs["weight"] [0, 10, 20]
If you specify a sequence that is shorter than the number of vertices in the VertexSeq, the sequence is reused:
>>> g = Graph.Tree(7, 2) >>> g.vs["color"] = ["red", "green"] >>> g.vs["color"] ['red', 'green', 'red', 'green', 'red', 'green', 'red']
You can even pass a single string or integer, it will be considered as a sequence of length 1:
>>> g.vs["color"] = "red" >>> g.vs["color"] ['red', 'red', 'red', 'red', 'red', 'red', 'red']
Some methods of the vertex sequences are simply proxy methods to the corresponding methods in the Graph object. One such example is VertexSeq.degree():
>>> g=Graph.Tree(7, 2) >>> g.vs.degree() [2, 3, 3, 1, 1, 1, 1] >>> g.vs.degree() == g.degree() True




Vertex 


VertexSeq 
















































Inherited from Inherited from Inherited from 


Inherited from Inherited from Inherited from 

Returns the first vertex of the vertex sequence that matches some criteria. The selection criteria are equal to the ones allowed by VertexSeq.select. See VertexSeq.select for more details. For instance, to find the first vertex with name >>> g.vs.find(name="foo") #doctest:+SKIP To find an arbitrary isolated vertex: >>> g.vs.find(_degree=0) #doctest:+SKIP

Selects a subset of the vertex sequence based on some criteria The selection criteria can be specified by the positional and the keyword arguments. Positional arguments are always processed before keyword arguments.
Keyword arguments can be used to filter the vertices based on their
attributes. The name of the keyword specifies the name of the attribute
and the filtering operator, they should be concatenated by an underscore
(
For instance, if you want to filter vertices with a numeric
>>> g.vs.select(age_gt=200) #doctest: +SKIP Similarly, to filter vertices whose >>> list_of_types = ["HR", "Finance", "Management"] >>> g.vs.select(type_in=list_of_types) #doctest: +SKIP If the operator is omitted, it defaults to >>> g.vs.select(cluster=2) #doctest: +SKIP In the case of an unknown operator, it is assumed that the recognized
operator is part of the attribute name and the actual operator is
Attribute names inferred from keyword arguments are treated specially
if they start with an underscore ( >>> g = Graph.Famous("zachary") >>> non_isolated = g.vs.select(_degree_gt=0) For properties that take a long time to be computed (e.g., betweenness
centrality for large graphs), it is advised to calculate the values in
advance and store it in a graph attribute. The same applies when you are
selecting based on the same property more than once in the same
>>> edges = g.vs.select(_betweenness_gt=10, _betweenness_lt=30)
It is advised to use this instead: >>> g.vs["bs"] = g.betweenness() >>> edges = g.vs.select(bs_gt=10, bs_lt=30)

Shorthand notation to select() This method simply passes all its arguments to VertexSeq.select(). 
Proxy method to Graph.betweenness() This method calls the See Also: Graph.betweenness() for details. 
Proxy method to Graph.bibcoupling() This method calls the See Also: Graph.bibcoupling() for details. 
Proxy method to Graph.closeness() This method calls the See Also: Graph.closeness() for details. 
Proxy method to Graph.cocitation() This method calls the See Also: Graph.cocitation() for details. 
Proxy method to Graph.constraint() This method calls the See Also: Graph.constraint() for details. 
Proxy method to Graph.degree() This method calls the See Also: Graph.degree() for details. 
Proxy method to Graph.delete_vertices() This method calls the See Also: Graph.delete_vertices() for details. 
Proxy method to Graph.diversity() This method calls the See Also: Graph.diversity() for details. 
Proxy method to Graph.eccentricity() This method calls the See Also: Graph.eccentricity() for details. 
Proxy method to Graph.get_shortest_paths() This method calls the See Also: Graph.get_shortest_paths() for details. 
Proxy method to Graph.indegree() This method calls the See Also: Graph.indegree() for details. 
Proxy method to Graph.is_minimal_separator() This method calls the See Also: Graph.is_minimal_separator() for details. 
Proxy method to Graph.is_separator() This method calls the See Also: Graph.is_separator() for details. 
Proxy method to Graph.isoclass() This method calls the See Also: Graph.isoclass() for details. 
Proxy method to Graph.maxdegree() This method calls the See Also: Graph.maxdegree() for details. 
Proxy method to Graph.outdegree() This method calls the See Also: Graph.outdegree() for details. 
Proxy method to Graph.pagerank() This method calls the See Also: Graph.pagerank() for details. 
Proxy method to Graph.personalized_pagerank() This method calls the See Also: Graph.personalized_pagerank() for details. 
Proxy method to Graph.shortest_paths() This method calls the See Also: Graph.shortest_paths() for details. 
Proxy method to Graph.similarity_dice() This method calls the See Also: Graph.similarity_dice() for details. 
Proxy method to Graph.similarity_jaccard() This method calls the See Also: Graph.similarity_jaccard() for details. 
Proxy method to Graph.subgraph() This method calls the See Also: Graph.subgraph() for details. 
Home  Trees  Indices  Help 


Generated by Epydoc 3.0.1 on Fri May 10 10:51:14 2019  http://epydoc.sourceforge.net 