Commit 2835d94e authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[lib] Fix typos

parent cefed40b
......@@ -41,9 +41,8 @@
"""
Classes for static analysis
"""
# Standard imports
import string
from __future__ import print_function
import networkx as nx
import copy
from collections import OrderedDict, Counter
......@@ -340,6 +339,7 @@ class StaticAnalyzer(object):
frontier_list = []
tvi = TableVisitor(self.reporter)
self.model.accept(tvi)
print("Table visitor", tvi)
for scc in scc_list:
# eliminate isolated frontier nodes
......@@ -895,7 +895,7 @@ class StaticAnalyzer(object):
final_list.extend(successors)
final_list = list(set(final_list))
print len(final_list)
print(len(final_list))
return final_list
......@@ -940,8 +940,8 @@ class StaticAnalyzer(object):
successors = self.get_successors(tr_graph, place, None)
final_list.extend(successors)
print len(list(set(final_list)))
print list(set(final_list))
print(len(list(set(final_list))))
print(list(set(final_list)))
return list(set(final_list))
def get_submodel(self, node_list):
......@@ -1014,45 +1014,44 @@ def stat_on_graph(graph):
"""
???
"""
print 'number of nodes : ', graph.order()
print 'number of edges : ', graph.number_of_edges()
print('number of nodes : ', graph.order())
print('number of edges : ', graph.number_of_edges())
print 'number of connected components : ', \
nx.number_connected_components(graph)
print('number of connected components : ', nx.number_connected_components(graph))
if nx.is_connected(graph):
print 'diameter : ', nx.diameter(graph) # max of shortest length
print 'average path length : ', nx.average_shortest_path_length(graph)
print 'density : ', nx.density(graph)
print 'clustering : ', nx.clustering(graph)
print('diameter : ', nx.diameter(graph)) # max of shortest length
print('average path length : ', nx.average_shortest_path_length(graph))
print('density : ', nx.density(graph))
print('clustering : ', nx.clustering(graph))
degree = graph.degree().items()
degree.sort(cmpval)
degree_moy = 0.0
for degree_couple in degree :
degree_moy += degree_couple[1]
print 'degree moy : ', degree_moy / graph.order()
print('degree moy : ', degree_moy / graph.order())
print 'degree median : ', degree[len(degree) / 2][1]
print 'degree : ', degree[:10]
print('degree median : ', degree[len(degree) / 2][1])
print('degree : ', degree[:10])
def stat_on_dgraph(dgraph):
"""
???
"""
print 'number of nodes : ', dgraph.order()
print 'number of edges : ', dgraph.number_of_edges()
print('number of nodes : ', dgraph.order())
print('number of edges : ', dgraph.number_of_edges())
nscc = nx.number_strongly_connected_components(dgraph)
print 'number of strongly connected components : ', nscc
print('number of strongly connected components : ', nscc)
in_degree = dgraph.in_degree().items()
in_degree.sort(cmpval)
print 'in degree : ', in_degree[:10]
print('in degree : ', in_degree[:10])
out_degree = dgraph.out_degree().items()
out_degree.sort(cmpval)
print 'out degree : ', out_degree[:10]
print('out degree : ', out_degree[:10])
def view_graph(graph):
......
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