Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
# -*- coding: utf-8 -*-
#  Copyright (c) 2022, Markus Binsteiner
#
#  Mozilla Public License, version 2.0 (see LICENSE or https://www.mozilla.org/en-US/MPL/2.0/)
from enum import Enum

NODE_ID_COLUMN_NAME = "_node_id"
EDGE_ID_COLUMN_NAME = "_edge_id"
SOURCE_COLUMN_NAME = "_source"
TARGET_COLUMN_NAME = "_target"
LABEL_COLUMN_NAME = "_label"

COMPONENT_ID_COLUMN_NAME = "component_id"

EDGES_TABLE_NAME = "edges"
NODES_TABLE_NAME = "nodes"


DEFAULT_NETWORK_DATA_CHUNK_SIZE = 1024

NODE_ID_ALIAS_NAMES = ["id", "node_id"]
LABEL_ALIAS_NAMES = ["label", "node_label"]

SOURCE_COLUMN_ALIAS_NAMES = ["source", "sources", "source_id", "from", "sender"]
TARGET_COLUMN_ALIAS_NAMES = ["target", "targets", "target_id", "to", "receiver"]

ATTRIBUTE_PROPERTY_KEY = "attribute_property"

# WEIGHT_COLUMN_ALIAS_NAMES = [
#     "weight",
#     "weights",
#     "edge_weight",
#     "edge_weights",
#     "strength",
#     "strengths",
# ]

COUNT_DIRECTED_COLUMN_NAME = "_count_dup_directed"
COUNT_UNDIRECTED_COLUMN_NAME = "_count_dup_undirected"
COUNT_IDX_DIRECTED_COLUMN_NAME = "_idx_dup_directed"
COUNT_IDX_UNDIRECTED_COLUMN_NAME = "_idx_dup_undirected"

IN_DIRECTED_COLUMN_NAME = "_in_edges"
OUT_DIRECTED_COLUMN_NAME = "_out_edges"
CONNECTIONS_COLUMN_NAME = "_count_edges"

IN_DIRECTED_MULTI_COLUMN_NAME = "_in_edges_multi"
OUT_DIRECTED_MULTI_COLUMN_NAME = "_out_edges_multi"
CONNECTIONS_MULTI_COLUMN_NAME = "_count_edges_multi"


RANKING_TABLE_NAME = "ranking"
RANKING_COLUNN_NAME = "_rank"
RANKING_VALUE_COLUMN_NAME = "_value"

AUTO_CALCULATED_EDGE_COLUMNS = [
    EDGE_ID_COLUMN_NAME,
    SOURCE_COLUMN_NAME,
    TARGET_COLUMN_NAME,
    COUNT_DIRECTED_COLUMN_NAME,
    COUNT_IDX_DIRECTED_COLUMN_NAME,
    COUNT_UNDIRECTED_COLUMN_NAME,
    COUNT_IDX_UNDIRECTED_COLUMN_NAME,
]


AUTO_CALCULATED_NODE_COLUMNS = [
    NODE_ID_COLUMN_NAME,
    LABEL_COLUMN_NAME,
    IN_DIRECTED_COLUMN_NAME,
    OUT_DIRECTED_COLUMN_NAME,
    IN_DIRECTED_MULTI_COLUMN_NAME,
    OUT_DIRECTED_MULTI_COLUMN_NAME,
]


class NetworkDataTableType(Enum):
    EDGES = EDGES_TABLE_NAME
    NODES = NODES_TABLE_NAME


class GraphType(Enum):
    UNDIRECTED = "undirected"
    DIRECTED = "directed"
    DIRECTED_MULTI = "directed_multi"
    UNDIRECTED_MULTI = "undirected_multi"


NODE_ID_TEXT = """The unique id for the node.

This is a unique integer identifier (counting up from 0) and is automatically generated by kiara, for each `network_data` value.
"""
NODE_LABEL_TEXT = """The label for the node.

This is a (potentially non-unique) (ideally) human meaningful lable for the node, mostly used in visualizations. Depending on
how the 'network_data' was created, this could be a name, title, etc. If no such label was available or specified
by the user, the node id will be used as label.
"""

NODE_COUNT_EDGES_TEXT = """The number of edges that are connected to this node if the network_data is interpreted as a non-multi graph

Both incoming and outgoing edges are counted, which means that the number is valid for both directed and undirected graphs.
."""
NODE_COUNT_EDGES_MULTI_TEXT = """The number of edges that are connected to this node if the network_data is interpreted as a multi graph

Both incoming and outgoing edges are counted, which means that the number is valid for both directed and undirected graphs."""
NODE_COUNT_IN_EDGES_TEXT = """The number of incoming edges that are connected to this node if the network_data is interpreted as a non-multi graph."""
NODE_COUNT_IN_EDGES_MULTI_TEXT = """The number of incoming edges that are connected to this node if the network_data is interpreted as a multi graph."""
NODE_COUNT_OUT_EDGES_TEXT = """The number of outgoing edges that are connected to this node if the network_data is interpreted as a non-multi graph."""
NODE_COUNT_OUT_EDGES_MULTI_TEXT = """The number of outgoing edges that are connected to this node if the network_data is interpreted as a multi graph."""

EDGE_ID_TEXT = """The unique id for the edge.

This is a unique integer identifier (counting up from 0) and is automatically generated by kiara, for each `network_data` value.
"""
EDGE_SOURCE_TEXT = """The node id of the source for an edge."""
EDGE_TARGET_TEXT = """The node id of the target for an edge."""

EDGE_COUNT_DUP_DIRECTED_TEXT = """The number of edges that have the same source/target combination as this (incl. this), if the network_data is interpreted as directed multi graph.
"""
EDGE_IDX_DUP_DIRECTED_TEXT = """A unique index for this edge within its set of duplicates, if the network_data is interpreted as directed multi graph.

This is a unique integer identifier in combination with (_source/_target), counting up from 0. The order of the edges within this set is not guaranteed.
"""
EDGE_COUNT_DUP_UNDIRECTED_TEXT = """The number of edges that have the same source/target combination as this (incl. this), if the network_data is interpreted as undirected multi graph."""
EDGE_IDX_DUP_UNDIRECTED_TEXT = """A unique index for this edge within its set of duplicates, if the network_data is interpreted as undirected multi graph.

This is a unique integer identifier in combination with (_source/_target), counting up from 0. The order of the edges within this set is not guaranteed.
"""