Commit cad9691d authored by Tiago Peixoto's avatar Tiago Peixoto

Documentation improvements

Added more DOI links to references, and other cosmetic changes.
parent d2e8ce3a
......@@ -132,6 +132,7 @@ from numpy import *
import scipy
import scipy.stats
from math import *
import numpy as np
import graph_tool.all as gt
"""
......@@ -231,7 +232,8 @@ intersphinx_mapping = {'http://docs.python.org': None,
extlinks = {'ticket': ('http://projects.skewed.de/graph-tool/ticket/%s',
'ticket '),
'doi': ('http://dx.doi.org/%s', 'DOI: ')}
'doi': ('http://dx.doi.org/%s', 'DOI: '),
'arxiv': ('http://arxiv.org/abs/%s', 'arXiv: ')}
autodoc_member_order='bysource'
autodoc_default_flags=['members']
autodoc_member_order = 'bysource'
autodoc_default_flags = ['members']
.. automodule:: graph_tool
:members:
Available subpackages
=====================
......
......@@ -92,7 +92,7 @@ from . core import __version__, Graph, Vector_bool, Vector_int32_t, \
__all__ = ["Graph", "Vertex", "Edge", "Vector_bool", "Vector_int32_t",
"Vector_int64_t", "Vector_double", "Vector_long_double",
"Vector_string", "value_types", "load_graph", "PropertyArray",
"PropertyMap", "group_vector_property", "ungroup_vector_property",
"show_config", "__author__", "__copyright__", "__URL__",
"Vector_string", "value_types", "load_graph", "PropertyMap",
"group_vector_property", "ungroup_vector_property", "show_config",
"PropertyArray", "__author__", "__copyright__", "__URL__",
"__version__"]
......@@ -237,7 +237,7 @@ def betweenness(g, vprop=None, eprop=None, weight=None, norm=True):
----------
.. [betweenness-wikipedia] http://en.wikipedia.org/wiki/Centrality#Betweenness_centrality
.. [brandes-faster-2001] U. Brandes, "A faster algorithm for betweenness
centrality", Journal of Mathematical Sociology, 2001
centrality", Journal of Mathematical Sociology, 2001, :doi:`10.1080/0022250X.2001.9990249`
"""
if vprop == None:
vprop = g.new_vertex_property("double")
......@@ -302,7 +302,7 @@ def central_point_dominance(g, betweenness):
References
----------
.. [freeman-set-1977] Linton C. Freeman, "A Set of Measures of Centrality
Based on Betweenness", Sociometry, Vol. 40, No. 1, pp. 35-41 (1977)
Based on Betweenness", Sociometry, Vol. 40, No. 1, pp. 35-41, 1977
"""
return libgraph_tool_centrality.\
......@@ -373,30 +373,30 @@ def eigentrust(g, trust_map, vprop=None, norm=False, epslon=1e-6, max_iter=0,
>>> trust.get_array()[:] = random(g.num_edges())*42
>>> t = gt.eigentrust(g, trust, norm=True)
>>> print t.get_array()
[ 0.01610395 0.03518828 0.00387335 0.00506519 0. 0.02120586
0.00328345 0.00514034 0.00361398 0.01331587 0.00626757 0.00788882
0.01599836 0.00607798 0.00879484 0.01028104 0.01742029 0.00522399
0.0206618 0.0098984 0.00918508 0.01344131 0. 0.00047679
0.01760032 0.00078869 0.01045936 0. 0.00387405 0.01761267
0.00730843 0.00514523 0.01708638 0.0084908 0.01237811 0.01401104
0.0209564 0.0132232 0.00031255 0.01400855 0. 0. 0.0077233
0.00479587 0.01646928 0.01499744 0.01901516 0.00843277 0.
0.01764526 0.00243523 0.01726375 0.01272935 0.0163525 0.00382533
0.02037745 0.00758792 0.00350063 0.01303079 0. 0.02086308
0.00062028 0.00841231 0.00983605 0.00327547 0. 0.01016667
0.0170241 0.00782474 0.00516862 0.02394048 0. 0.00747778
0.00792131 0.01495136 0.01513948 0.02287957 0.00788276 0.0053207
0.00145811 0.00183203 0.0033493 0.01627589 0. 0.00476343
0.00937439 0.00200381 0.01400712 0.02135004 0.00549685 0.00230923
0.01426992 0.01083921 0.03439618 0.00514281 0.00114438 0.02259093
0.00672266 0.02753108 0.01859351]
[ 0.02100449 0.01735932 0.00227182 0.00342703 0. 0.01739914
0.00658874 0.00592764 0.00879695 0.01483758 0.00390145 0.00939709
0.01038803 0.00896039 0.0080222 0.00583084 0.01510505 0.01106463
0.02048866 0.0179936 0.02196625 0.00604554 0. 0.00038504
0.01704679 0.00431482 0.00538866 0. 0.00163772 0.02009726
0.00254747 0.00440903 0.02305541 0.01061566 0.00583414 0.01521545
0.01894677 0.00941793 0.00259066 0.00454916 0. 0.
0.00411855 0.01005776 0.029152 0.01500648 0.00797009 0.02057446
0. 0.02100182 0.00519358 0.02503401 0.00368714 0.02176737
0.00111934 0.02763714 0.00615445 0.00163793 0.01998869 0.
0.00831816 0.00692008 0.00439715 0.01287125 0.00534507 0.
0.00805071 0.02094972 0.00622514 0.00285397 0.01009464 0.
0.00360911 0.00653993 0.00800227 0.01521205 0.02901848 0.01693622
0.00323205 0.00748302 0.00443795 0.0076314 0.01147831 0.
0.00129362 0.00173367 0.00188625 0.02110825 0.01349257 0.00956502
0.00694694 0.01780551 0.00344632 0.02869166 0.00388418 0.0016279
0.01691452 0.00783781 0.02795918 0.03327071]
References
----------
.. [kamvar-eigentrust-2003] S. D. Kamvar, M. T. Schlosser, H. Garcia-Molina
"The eigentrust algorithm for reputation management in p2p networks",
Proceedings of the 12th international conference on World Wide Web,
Pages: 640 - 651, 2003
Pages: 640 - 651, 2003, :doi:`10.1145/775152.775242`
"""
if vprop == None:
......@@ -454,7 +454,7 @@ def trust_transitivity(g, trust_map, source=None, target=None, vprop=None):
Notes
-----
The absolute trust between vertices i and j is defined as
The pervasive trust transitivity between vertices i and j is defined as
.. math::
......@@ -491,23 +491,29 @@ def trust_transitivity(g, trust_map, source=None, target=None, vprop=None):
>>> trust.a = random(g.num_edges())
>>> t = gt.trust_transitivity(g, trust, source=g.vertex(0))
>>> print t.a
[ 1. 0.15271582 0.07130332 0.10597708 0. 0.58940763
0.04233924 0.03619048 0.04137002 0.05926363 0.06584407 0.06315985
0.22301815 0.02671845 0.10566551 0.08018763 0.57668762 0.08440303
0.17612948 0.37579015 0.0415804 0.19919108 0. 0.0141547
0.14901031 0.00910391 0.02680543 0. 0.0887711 0.0296914
0.09800672 0.06421615 0.16420105 0.10226839 0.08667606 0.07944174
0.17174637 0.10932321 0.0137295 0.09342906 0. 0.
0.11065065 0.03725047 0.23554212 0.10971862 0.54564134 0.0462946 0.
0.24820041 0.15281463 0.09449931 0.22419781 0.03108608 0.10964166
0.08642532 0.03495468 0.05656444 0.04045297 0. 0.13789871
0.0197414 0.05512572 0.08297112 0.21448002 0. 0.08649514
0.0718887 0.16546776 0.04108292 0.11710843 0. 0.12518596
0.04797708 0.02275816 0.10413969 0.1294644 0.08656727 0.28371423
0.1036658 0.01575087 0.02023104 0.067158 0. 0.03241519
0.19613692 0.05684533 0.29652909 0.03038526 0.02423028 0.01695595
0.0759531 0.17360708 0.51113999 0.03714076 0.03167552 0.04359062
0.0267188 0.47605313 0.06471942]
[ 1. 0.09649648 0.01375374 0.09864347 0. 0.52668732
0.02655169 0.05771735 0.25651251 0.13071344 0.1258206 0.13065921
0.12051013 0.13754053 0.26727787 0.06951245 0.38774441 0.25343023
0.21297027 0.59232433 0.10843174 0.02810649 0. 0.04000351
0.13784095 0.06125175 0.04156937 0. 0.05771925 0.04967184
0.11251086 0.25172931 0.1982562 0.28225643 0.05339001 0.10629504
0.04440744 0.05815895 0.097983 0.03333347 0. 0.
0.10845473 0.13751647 0.27567139 0.03946153 0.25063883 0.0755547 0.
0.25167962 0.33205973 0.08237051 0.12983804 0.02587608 0.09694727
0.16435599 0.09445501 0.07402817 0.06425702 0. 0.22420236
0.11284837 0.05567628 0.0561254 0.36563496 0. 0.09358333
0.06315609 0.3853858 0.01338133 0.08506159 0. 0.23226712
0.0841518 0.07274848 0.17553984 0.14032908 0.15737553 0.13703351
0.25035262 0.03570828 0.04341688 0.11955905 0. 0.01757771
0.04990193 0.10457395 0.41668972 0.04546921 0.04404905 0.24922167
0.09752267 0.03872946 0.26113888 0.04677363 0.03220735 0.03928181
0.08696124 0.21697483 0.1388346 ]
References
----------
.. [richters-trust-2010] Oliver Richters, Tiago P. Peixoto, "Trust
transitivity in social networks", :arXiv:`1012.1358`, 2010
"""
if vprop == None:
......
......@@ -121,7 +121,7 @@ def local_clustering(g, prop=None, undirected=False):
----------
.. [watts-collective-1998] D. J. Watts and Steven Strogatz, "Collective
dynamics of 'small-world' networks", Nature, vol. 393, pp 440-442, 1998.
doi:10.1038/30918
:doi:`10.1038/30918`
"""
if prop == None:
......@@ -183,7 +183,8 @@ def global_clustering(g):
References
----------
.. [newman-structure-2003] M. E. J. Newman, "The structure and function of
complex networks", SIAM Review, vol. 45, pp. 167-256, 2003
complex networks", SIAM Review, vol. 45, pp. 167-256, 2003,
:doi:`10.1137/S003614450342480`
"""
c =_gt.global_clustering(g._Graph__graph)
......@@ -261,7 +262,7 @@ def extended_clustering(g, props=None, max_depth=3, undirected=False):
References
----------
.. [abdo-clustering] A. H. Abdo, A. P. S. de Moura, "Clustering as a
measure of the local topology of networks", arXiv:physics/0605235v4
measure of the local topology of networks", :arxiv:`physics/0605235`
"""
was_directed = g.is_directed()
......@@ -345,6 +346,7 @@ def motifs(g, k, p=1.0, motif_list=None, undirected=None):
.. [wernicke-efficient-2006] S. Wernicke, "Efficient detection of network
motifs", IEEE/ACM Transactions on Computational Biology and
Bioinformatics (TCBB), Volume 3, Issue 4, Pages 347-359, 2006.
:doi:`10.1109/TCBB.2006.51`
"""
seed = random.randint(0, sys.maxint)
......
......@@ -193,10 +193,10 @@ def community_structure(g, n_iter, n_spins, gamma=1.0, corr="erdos",
----------
.. [reichard-statistical-2006] Joerg Reichardt and Stefan Bornholdt,
"Statistical Mechanics of Community Detection", Phys. Rev. E 74 (2006)
016110, arXiv:cond-mat/0603718
016110, :doi:`10.1103/PhysRevE.74.016110`, :arxiv:`cond-mat/0603718`
.. [newman-modularity-2006] M. E. J. Newman, "Modularity and community
structure in networks", Proc. Natl. Acad. Sci. USA 103, 8577-8582 (2006),
arXiv:physics/0602124
:doi:`10.1073/pnas.0601602103`, :arxiv:`physics/0602124`
.. _simulated annealing: http://en.wikipedia.org/wiki/Simulated_annealing
"""
......@@ -216,6 +216,7 @@ def community_structure(g, n_iter, n_spins, gamma=1.0, corr="erdos",
_prop("v", g, spins))
return spins
def modularity(g, prop, weight=None):
r"""
Calculate Newman's modularity.
......@@ -269,7 +270,7 @@ def modularity(g, prop, weight=None):
----------
.. [newman-modularity-2006] M. E. J. Newman, "Modularity and community
structure in networks", Proc. Natl. Acad. Sci. USA 103, 8577-8582 (2006),
arXiv:physics/0602124
:doi:`10.1073/pnas.0601602103`, :arxiv:`physics/0602124`
"""
m = libgraph_tool_community.modularity(g._Graph__graph,
......
......@@ -113,7 +113,7 @@ def assortativity(g, deg):
References
----------
.. [newman-mixing-2003] M. E. J. Newman, "Mixing patterns in networks",
Phys. Rev. E 67, 026126 (2003)
Phys. Rev. E 67, 026126 (2003), :doi:`10.1103/PhysRevE.67.026126`
.. _jackknife method: http://en.wikipedia.org/wiki/Resampling_%28statistics%29#Jackknife
"""
......@@ -188,7 +188,7 @@ def scalar_assortativity(g, deg):
References
----------
.. [newman-mixing-2003] M. E. J. Newman, "Mixing patterns in networks",
Phys. Rev. E 67, 026126 (2003)
Phys. Rev. E 67, 026126 (2003), :doi:`10.1103/PhysRevE.67.026126`
.. _jackknife method: http://en.wikipedia.org/wiki/Resampling_%28statistics%29#Jackknife
"""
return libgraph_tool_correlations.\
......
......@@ -130,7 +130,7 @@ def edmonds_karp_max_flow(g, source, target, capacity, residual=None):
.. [boost-edmonds-karp] http://www.boost.org/libs/graph/doc/edmonds_karp_max_flow.html
.. [edmonds-theoretical-1972] Jack Edmonds and Richard M. Karp, "Theoretical
improvements in the algorithmic efficiency for network flow problems.
Journal of the ACM", 1972 19:248-264
Journal of the ACM", 19:248-264, 1972 :doi:`10.1145/321694.321699`
.. [ravindra-network-1993] Ravindra K. Ahuja and Thomas L. Magnanti and
James B. Orlin,"Network Flows: Theory, Algorithms, and Applications".
Prentice Hall, 1993.
......
......@@ -807,7 +807,7 @@ def geometric_graph(points, radius, ranges=None):
References
----------
.. [geometric-graph] Jesper Dall and Michael Christensen, "Random geometric
graphs", Phys. Rev. E 66, 016121 (2002), DOI: 10.1103/PhysRevE.66.016121
graphs", Phys. Rev. E 66, 016121 (2002), :doi:`10.1103/PhysRevE.66.016121`
"""
......@@ -923,17 +923,17 @@ def price_network(N, m=1, c=None, gamma=1, directed=True, seed_graph=None):
.. [yule] Yule, G. U. "A Mathematical Theory of Evolution, based on the
Conclusions of Dr. J. C. Willis, F.R.S.". Philosophical Transactions of
the Royal Society of London, Ser. B 213: 21–87, 1925,
doi:10.1098/rstb.1925.0002
:doi:`10.1098/rstb.1925.0002`
.. [price] Derek De Solla Price, "A general theory of bibliometric and other
cumulative advantage processes", Journal of the American Society for
Information Science, Volume 27, Issue 5, pages 292–306, September 1976,
DOI: 10.1002/asi.4630270505
:doi:`10.1002/asi.4630270505`
.. [barabasi-albert] Barabási, A.-L., and Albert, R., "Emergence of
scaling in random networks", Science, 286, 509, 1999;
DOI: 10.1126/science.286.5439.509
scaling in random networks", Science, 286, 509, 1999,
:doi:`10.1126/science.286.5439.509`
.. [dorogovtsev-evolution] S. N. Dorogovtsev and J. F. F. Mendes, "Evolution
of networks", Advances in Physics, 2002, Vol. 51, No. 4, 1079-1187,
DOI: 10.1080/00018730110112519
:doi:`10.1080/00018730110112519`
"""
if c is None:
......
......@@ -143,7 +143,7 @@ def subgraph_isomorphism(sub, g, max_n=0, random=True):
References
----------
.. [ullmann-algorithm-1976] Ullmann, J. R., "An algorithm for subgraph
isomorphism", Journal of the ACM 23 (1): 31–42, 1976, doi:10.1145/321921.321925
isomorphism", Journal of the ACM 23 (1): 31–42, 1976, :doi:`10.1145/321921.321925`
.. [subgraph-isormophism-wikipedia] http://en.wikipedia.org/wiki/Subgraph_isomorphism_problem
"""
......@@ -255,7 +255,8 @@ def min_spanning_tree(g, weights=None, root=None, tree_map=None):
----------
.. [kruskal-shortest-1956] J. B. Kruskal. "On the shortest spanning subtree
of a graph and the traveling salesman problem", In Proceedings of the
American Mathematical Sofiety, volume 7, pages 48-50, 1956.
American Mathematical Society, volume 7, pages 48-50, 1956.
:doi:`10.1090/S0002-9939-1956-0078686-7`
.. [prim-shortest-1957] R. Prim. "Shortest connection networks and some
generalizations", Bell System Technical Journal, 36:1389-1401, 1957.
.. [boost-mst] http://www.boost.org/libs/graph/doc/graph_theory_review.html#sec:minimum-spanning-tree
......@@ -659,10 +660,11 @@ def shortest_distance(g, source=None, weights=None, max_dist=None,
----------
.. [bfs] Edward Moore, "The shortest path through a maze", International
Symposium on the Theory of Switching (1959), Harvard University
Press;http://www.boost.org/libs/graph/doc/breadth_first_search.html
Press;
.. [bfs-boost] http://www.boost.org/libs/graph/doc/breadth_first_search.html
.. [dijkstra] E. Dijkstra, "A note on two problems in connexion with
graphs." Numerische Mathematik, 1:269-271, 1959.
http://www.boost.org/libs/graph/doc/dijkstra_shortest_paths.html
.. [dijkstra-boost] http://www.boost.org/libs/graph/doc/dijkstra_shortest_paths.html
.. [johnson-apsp] http://www.boost.org/libs/graph/doc/johnson_all_pairs_shortest.html
.. [floyd-warshall-apsp] http://www.boost.org/libs/graph/doc/floyd_warshall_shortest.html
"""
......@@ -764,10 +766,11 @@ def shortest_path(g, source, target, weights=None, pred_map=None):
----------
.. [bfs] Edward Moore, "The shortest path through a maze", International
Symposium on the Theory of Switching (1959), Harvard University
Press;http://www.boost.org/libs/graph/doc/breadth_first_search.html
Press
.. [bfs-boost] http://www.boost.org/libs/graph/doc/breadth_first_search.html
.. [dijkstra] E. Dijkstra, "A note on two problems in connexion with
graphs." Numerische Mathematik, 1:269-271, 1959.
http://www.boost.org/libs/graph/doc/dijkstra_shortest_paths.html
.. [dijkstra-boost] http://www.boost.org/libs/graph/doc/dijkstra_shortest_paths.html
"""
if pred_map == None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment