Loading autocnet/graph/markov_cluster.py +4 −3 Original line number Diff line number Diff line Loading @@ -101,7 +101,8 @@ def mcl(g, expand_factor=2, inflate_factor=2, max_loop=10, mult_factor=1): arr = _expand(arr, expand_factor) # Check for convergence if _stop(arr, i): break if _stop(arr, i): break clusters = _get_clusters(arr) return arr, clusters autocnet/graph/network.py +9 −11 Original line number Diff line number Diff line import itertools import math import os import warnings Loading Loading @@ -142,7 +141,6 @@ class CandidateGraph(nx.Graph): return cls(adjacency_dict) @classmethod def from_adjacency(cls, input_adjacency, basepath=None): """ Loading Loading @@ -530,6 +528,7 @@ class CandidateGraph(nx.Graph): matches = edge.matches self.cn.add_correspondences(edge, matches) def to_json_file(self, outputfile): """ Write the edge structure to a JSON adjacency list Loading Loading @@ -655,11 +654,10 @@ class CandidateGraph(nx.Graph): The number of edges or sum of edge weights in the graph. """ s = sum(self.degree(weight=weight).values()) / 2 if weight is None: return math.ceil(s) if weight: return sum(e[weight] for s, d, e in self.edges_iter(data=True)) else: return s return len(self.edges()) def create_node_subgraph(self, nodes): """ Loading autocnet/graph/node.py +3 −3 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ class Node(dict, MutableMapping): Type: {} """.format(self.node_id, self.image_name, self.image_path, self.nkeypoints, self.masks, self.__class__) @property def geodata(self): if not getattr(self, '_geodata', None): Loading Loading @@ -342,4 +343,3 @@ class Node(dict, MutableMapping): mask = panel[clean_keys].all(axis=1) matches = self._keypoints[mask] return matches, mask autocnet/graph/tests/test_edge.py +1 −3 Original line number Diff line number Diff line Loading @@ -2,11 +2,11 @@ import unittest from unittest.mock import Mock import pandas as pd import numpy as np from .. import edge from .. import node class TestEdge(unittest.TestCase): def setUp(self): Loading Loading @@ -44,5 +44,3 @@ class TestEdge(unittest.TestCase): def test_compute_fundamental_matrix(self): with self.assertRaises(AttributeError): self.edge.compute_fundamental_matrix() autocnet/graph/tests/test_markov_cluster.py +0 −2 Original line number Diff line number Diff line Loading @@ -24,5 +24,3 @@ class TestMarkovCluster(unittest.TestCase): flow, clusters = markov_cluster.mcl(arr) self.assertIsInstance(clusters, dict) self.assertEqual(len(clusters), 3) Loading
autocnet/graph/markov_cluster.py +4 −3 Original line number Diff line number Diff line Loading @@ -101,7 +101,8 @@ def mcl(g, expand_factor=2, inflate_factor=2, max_loop=10, mult_factor=1): arr = _expand(arr, expand_factor) # Check for convergence if _stop(arr, i): break if _stop(arr, i): break clusters = _get_clusters(arr) return arr, clusters
autocnet/graph/network.py +9 −11 Original line number Diff line number Diff line import itertools import math import os import warnings Loading Loading @@ -142,7 +141,6 @@ class CandidateGraph(nx.Graph): return cls(adjacency_dict) @classmethod def from_adjacency(cls, input_adjacency, basepath=None): """ Loading Loading @@ -530,6 +528,7 @@ class CandidateGraph(nx.Graph): matches = edge.matches self.cn.add_correspondences(edge, matches) def to_json_file(self, outputfile): """ Write the edge structure to a JSON adjacency list Loading Loading @@ -655,11 +654,10 @@ class CandidateGraph(nx.Graph): The number of edges or sum of edge weights in the graph. """ s = sum(self.degree(weight=weight).values()) / 2 if weight is None: return math.ceil(s) if weight: return sum(e[weight] for s, d, e in self.edges_iter(data=True)) else: return s return len(self.edges()) def create_node_subgraph(self, nodes): """ Loading
autocnet/graph/node.py +3 −3 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ class Node(dict, MutableMapping): Type: {} """.format(self.node_id, self.image_name, self.image_path, self.nkeypoints, self.masks, self.__class__) @property def geodata(self): if not getattr(self, '_geodata', None): Loading Loading @@ -342,4 +343,3 @@ class Node(dict, MutableMapping): mask = panel[clean_keys].all(axis=1) matches = self._keypoints[mask] return matches, mask
autocnet/graph/tests/test_edge.py +1 −3 Original line number Diff line number Diff line Loading @@ -2,11 +2,11 @@ import unittest from unittest.mock import Mock import pandas as pd import numpy as np from .. import edge from .. import node class TestEdge(unittest.TestCase): def setUp(self): Loading Loading @@ -44,5 +44,3 @@ class TestEdge(unittest.TestCase): def test_compute_fundamental_matrix(self): with self.assertRaises(AttributeError): self.edge.compute_fundamental_matrix()
autocnet/graph/tests/test_markov_cluster.py +0 −2 Original line number Diff line number Diff line Loading @@ -24,5 +24,3 @@ class TestMarkovCluster(unittest.TestCase): flow, clusters = markov_cluster.mcl(arr) self.assertIsInstance(clusters, dict) self.assertEqual(len(clusters), 3)