How to use dynetx - 10 common examples

To help you get started, we’ve selected a few dynetx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GiulioRossetti / dynetx / dynetx / readwrite / edgelist.py View on Github external
def parse_interactions(lines, comments='#', directed=False, delimiter=None, nodetype=None, timestamptype=None,
                       keys=None):
    if not directed:
        G = DynGraph()
    else:
        G = DynDiGraph()

    for line in lines:

        p = line.find(comments)
        if p >= 0:
            line = line[:p]
        if not len(line):
            continue

        s = line.strip().split(delimiter)

        if len(s) != 4:
            continue
        else:
github GiulioRossetti / dynetx / dynetx / readwrite / edgelist.py View on Github external
def parse_snapshots(lines, comments='#', directed=False, delimiter=None, nodetype=None, timestamptype=None, keys=None):
    if not directed:
        G = DynGraph()
    else:
        G = DynDiGraph()

    for line in lines:
        p = line.find(comments)
        if p >= 0:
            line = line[:p]
        if not len(line):
            continue
        # split line, should have 2 or more
        s = line.strip().split(delimiter)
        if len(s) < 3:
            continue
        if len(s) == 3:
            u = s.pop(0)
            v = s.pop(0)
github GiulioRossetti / dynetx / dynetx / readwrite / edgelist.py View on Github external
def parse_snapshots(lines, comments='#', directed=False, delimiter=None, nodetype=None, timestamptype=None, keys=None):
    if not directed:
        G = DynGraph()
    else:
        G = DynDiGraph()

    for line in lines:
        p = line.find(comments)
        if p >= 0:
            line = line[:p]
        if not len(line):
            continue
        # split line, should have 2 or more
        s = line.strip().split(delimiter)
        if len(s) < 3:
            continue
        if len(s) == 3:
            u = s.pop(0)
            v = s.pop(0)
            t = s.pop(0)
            e = None
github GiulioRossetti / dynetx / dynetx / readwrite / edgelist.py View on Github external
def parse_interactions(lines, comments='#', directed=False, delimiter=None, nodetype=None, timestamptype=None,
                       keys=None):
    if not directed:
        G = DynGraph()
    else:
        G = DynDiGraph()

    for line in lines:

        p = line.find(comments)
        if p >= 0:
            line = line[:p]
        if not len(line):
            continue

        s = line.strip().split(delimiter)

        if len(s) != 4:
            continue
        else:
            u = s.pop(0)
            v = s.pop(0)
github GiulioRossetti / dynetx / dynetx / readwrite / edgelist.py View on Github external
def read_ids(path, delimiter=None, timestamptype=None):
    f = open(path)
    ids = {}
    for line in f:
        s = line.rstrip().split(delimiter)
        ids[timestamptype(s[-1])] = None
        if len(line) == 4:
            if s[-2] not in ['+', '-']:
                ids[timestamptype(s[-2])] = None

    f.flush()
    f.close()

    ids = compact_timeslot(ids.keys())
    return ids
github GiulioRossetti / dynetx / dynetx / classes / dyngraph.py View on Github external
    @not_implemented()
    def add_edges_from(self, ebunch, attr_dict=None, **attr):
        pass
github GiulioRossetti / dynetx / dynetx / classes / dyndigraph.py View on Github external
    @not_implemented()
    def remove_edge(self, u, v):
        pass
github GiulioRossetti / dynetx / dynetx / classes / function.py View on Github external
@not_implemented()
def get_edge_attributes(G, name):
    pass
github GiulioRossetti / dynetx / dynetx / classes / dyndigraph.py View on Github external
    @not_implemented()
    def add_edges_from(self, ebunch, attr_dict=None, **attr):
        pass
github GiulioRossetti / dynetx / dynetx / classes / dyngraph.py View on Github external
    @not_implemented()
    def remove_edges_from(self, ebunch):
        pass