How to use the graphistry.constants.BINDINGS function in graphistry

To help you get started, we’ve selected a few graphistry 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 graphistry / pygraphistry / graphistry / ext / igraph_to_arrow.py View on Github external
def _src_dst_columns(edgeSequence):
    yield arrow.column(BINDINGS.EDGE_SRC, [
        [edge.tuple[0] for edge in edgeSequence]
    ])

    yield arrow.column(BINDINGS.EDGE_DST, [
        [edge.tuple[1] for edge in edgeSequence]
    ])
github graphistry / pygraphistry / graphistry / ext / networkx_to_arrow.py View on Github external
def _node_columns(graph):
    attribute_names = set(
        key
        for _, nodeAttributes in graph.nodes(data=True)
        for key in nodeAttributes.keys()
    )

    yield pyarrow.column(BINDINGS.NODE_ID, [ # TODO(cwharris): make this name configurable
        [nodeId for nodeId in graph.nodes()]
    ])

    for attributeName in attribute_names:
        attributeValues = graph.get_node_attributes(attributeName)
        yield pyarrow.column(attributeName, [
            [attributeValues[node]
                if node in attributeValues else None for node in graph.nodes()]
        ])
github graphistry / pygraphistry / graphistry / ext / networkx_to_arrow.py View on Github external
def _edge_columns(graph):
    attribute_names = set(
        key
        for _, _, edgeAttributes in graph.edges(data=True)
        for key in edgeAttributes.keys()
    )

    yield pyarrow.column(BINDINGS.EDGE_SRC, [
        [srcId for srcId, _ in graph.edges()]
    ])

    yield pyarrow.column(BINDINGS.EDGE_DST, [
        [dstId for _, dstId in graph.edges()]
    ])

    for attributeName in attribute_names:
        attributeValues = graph.get_node_attributes(attributeName)
        yield pyarrow.column(attributeName, [
            [attributeValues[edge]
                if edge in attributeValues else None for edge in graph.edges()]
        ])
github graphistry / pygraphistry / graphistry / ext / igraph_to_arrow.py View on Github external
def to_arrow(graph):
    if not isinstance(graph, igraph.Graph):
        return None

    nodes = arrow.Table.from_arrays(
        [column for column in itertools.chain(
            _id_columns(graph.vs, BINDINGS.NODE_ID),
            _attribute_columns(graph.vs)
        )]
    )

    edges = arrow.Table.from_arrays(
        [column for column in itertools.chain(
            _id_columns(graph.es, BINDINGS.EDGE_ID),
            _src_dst_columns(graph.es),
            _attribute_columns(graph.es)
        )]
    )

    return (edges, nodes)
github graphistry / pygraphistry / graphistry / ext / igraph_to_arrow.py View on Github external
def _src_dst_columns(edgeSequence):
    yield arrow.column(BINDINGS.EDGE_SRC, [
        [edge.tuple[0] for edge in edgeSequence]
    ])

    yield arrow.column(BINDINGS.EDGE_DST, [
        [edge.tuple[1] for edge in edgeSequence]
    ])
github graphistry / pygraphistry / graphistry / ext / networkx_to_arrow.py View on Github external
def _edge_columns(graph):
    attribute_names = set(
        key
        for _, _, edgeAttributes in graph.edges(data=True)
        for key in edgeAttributes.keys()
    )

    yield pyarrow.column(BINDINGS.EDGE_SRC, [
        [srcId for srcId, _ in graph.edges()]
    ])

    yield pyarrow.column(BINDINGS.EDGE_DST, [
        [dstId for _, dstId in graph.edges()]
    ])

    for attributeName in attribute_names:
        attributeValues = graph.get_node_attributes(attributeName)
        yield pyarrow.column(attributeName, [
            [attributeValues[edge]
                if edge in attributeValues else None for edge in graph.edges()]
        ])