Esempio n. 1
0
def test_is_triad():
    """Tests the is_triad function"""
    G = nx.karate_club_graph()
    G = G.to_directed()
    for i in range(100):
        nodes = sample(G.nodes(), 3)
        G2 = G.subgraph(nodes)
        assert nx.is_triad(G2)
Esempio n. 2
0
def test_random_triad():
    """Tests the random_triad function"""
    G = nx.karate_club_graph()
    G = G.to_directed()
    for i in range(100):
        assert nx.is_triad(nx.random_triad(G))