File: api_1.6.rst

package info (click to toggle)
python-networkx 1.7~rc1-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,128 kB
  • sloc: python: 44,557; makefile: 135
file content (122 lines) | stat: -rw-r--r-- 3,394 bytes parent folder | download | duplicates (2)
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
*********************************
Version 1.6 notes and API changes
*********************************

This page reflects API changes from networkx-1.5 to networkx-1.6.

Please send comments and questions to the networkx-discuss mailing list:
http://groups.google.com/group/networkx-discuss .

Graph Classes
-------------

The degree* methods in the graph classes (Graph, DiGraph, MultiGraph,
MultiDiGraph) now take an optional weight= keyword that allows computing
weighted degree with arbitrary (numerical) edge attributes.  Setting 
weight=None is equivalent to the previous weighted=False.


Weighted graph algorithms
-------------------------

Many 'weighted' graph algorithms now take optional parameter to 
specifiy which edge attribute should be used for the weight
(default='weight') (:ticket:`573`)

In some cases the parameter name was changed from weighted, to weight.  Here is
how to specify which edge attribute will be used in the algorithms:

- Use weight=None to consider all weights equally (unweighted case)

- Use weight='weight' to use the 'weight' edge atribute

- Use weight='other' to use the 'other' edge attribute 

Algorithms affected are:

to_scipy_sparse_matrix, 
clustering,
average_clustering,
bipartite.degree,
spectral_layout,
neighbor_degree,
is_isomorphic,
betweenness_centrality,
betweenness_centrality_subset,
vitality,
load_centrality,
mincost,
shortest_path,
shortest_path_length,
average_shortest_path_length


Isomorphisms
------------

Node and edge attributes are now more easily incorporated into isomorphism
checks via the 'node_match' and 'edge_match' parameters.  As part of this
change, the following classes were removed::

    WeightedGraphMatcher
    WeightedDiGraphMatcher
    WeightedMultiGraphMatcher
    WeightedMultiDiGraphMatcher

The function signature for 'is_isomorphic' is now simply::

    is_isomorphic(g1, g2, node_match=None, edge_match=None)

See its docstring for more details.  To aid in the creation of 'node_match'
and 'edge_match' functions, users are encouraged to work with::

    categorical_node_match
    categorical_edge_match
    categroical_multiedge_match
    numerical_node_match
    numerical_edge_match
    numerical_multiedge_match
    generic_node_match
    generic_edge_match
    generic_multiedge_match

These functions construct functions which can be passed to 'is_isomorphic'.
Finally, note that the above functions are not imported into the top-level
namespace and should be accessed from 'networkx.algorithms.isomorphism'.
A useful import statement that will be repeated throughout documentation is::

    import networkx.algorithms.isomorphism as iso

Other
-----
* attracting_components

  A list of lists is returned instead of a list of tuples.

* condensation

  The condensation algorithm now takes a second argument (scc) and returns a   
  graph with nodes labeled as integers instead of node tuples.

* degree connectivity

  average_in_degree_connectivity and average_out_degree_connectivity have 
  have been replaced with 

  average_degree_connectivity(G, source='in', target='in')

  and

  average_degree_connectivity(G, source='out', target='out')

* neighbor degree

  average_neighbor_in_degree and  average_neighbor_out_degreey have 
  have been replaced with 

  average_neighbor_degree(G, source='in', target='in')

  and

  average_neighbor_degree(G, source='out', target='out')