How to use the dynetx.DynDiGraph function in dynetx

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_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)