Commit d019eec0 authored by Jay's avatar Jay
Browse files

Addresses @Kelvinrr comments

parent eef8dd05
Loading
Loading
Loading
Loading
+3 −28
Original line number Diff line number Diff line
@@ -882,28 +882,6 @@ class CandidateGraph(nx.Graph):
            A networkx subgraph object
        """
        return self.edge_subgraph(edges)
        H = self.__class__()
        adj = self.adj
        # Filter out edges that don't correspond to nodes in the graph.
        edges = ((u, v) for u, v in edges if u in adj and v in adj[u])
        for u, v in edges:
            # Copy the node attributes if they haven't been copied
            # already.
            if u not in H.node:
                H.node[u] = self.node[u]
            if v not in H.node:
                H.node[v] = self.node[v]
            # Create an entry in the adjacency dictionary for the
            # nodes u and v if they don't exist yet.
            if u not in H.adj:
                H.adj[u] = H.adjlist_dict_factory()
            if v not in H.adj:
                H.adj[v] = H.adjlist_dict_factory()
            # Copy the edge attributes.
            H.edge[u][v] = self.edge[u][v]
            # H.edge[v][u] = self.edge[v][u]
        H.graph = self.graph
        return H

    def size(self, weight=None):
        """
@@ -1149,13 +1127,10 @@ class CandidateGraph(nx.Graph):
        """
        Checks if the graph is a complete graph
        """
        neighbors = nx.degree(self)
        for edge in neighbors:
            if edge == len(self.neighbors(self.nodes)):
                continue
            else:
        nneighbors = len(self) - 1
        for n in self.nodes:
            if self.degree(n) != nneighbors:
                return False

        return True

    def footprints(self):
+2 −2
Original line number Diff line number Diff line
@@ -448,14 +448,14 @@ def test_update_data(graph):
   ntime = graph.graph['modifieddate']
   assert ctime != ntime

"""def test_is_complete(graph):
def test_is_complete(graph):
    # Create a small incomplete graph with three nodes and two edges
    incomplete_graph = network.CandidateGraph()
    incomplete_graph.add_nodes_from([1, 2, 3])
    incomplete_graph.add_edges_from([(1, 2), (2, 3)])

    assert False == incomplete_graph.is_complete()
    assert True == graph.is_complete()"""
    assert True == graph.is_complete()

def test_get_matches(candidategraph):
    matches = candidategraph.get_matches()