Skip to content

ChuongQuoc1413017/Hypergraph_RD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hypergraph_RD

Python package for Random and Dynamical Hypergraph Computation

Library Requirement

  • mandatory: random, itertools, numpy
  • optional: networkx, hypernetx, xgi

Structure

  • HyperRD.Hgraph: store all class objects
    • Hgraph.Create: undirected hypergraph object, including the following features and methods:
      • Features:
        • vertices: python set of vertices
        • vertices_dict: python dictionary of vertices
        • vertices_weight: python list of vertex weights (still developed)
        • edges: python set of hyperedges
        • edges_dict: python dictionary of hyperedges
        • edges_weight: python list of hyperedge weights (still developed)
        • inci_matrix: numpy matrix of an incidence matrix representation
      • Methods:
        • add_vertex(): add a vertex
        • add_edge(): add a hyperedge
        • dict_of_vertices(): return vertices in terms of an encoded dictionary
        • dict_of_edges(): return hyperedges in terms of an encoded dictionary
        • degree_vertex(): return a degree of a vertex
        • degree_edge(): return a degree of a hyperedge
        • diag_vertex(): return a numpy diagonal matrix of vertex degrees
        • diag_edge(): return a numpy diagonal matrix of hyperedge degrees
        • remove_vertex(): remove a vertex
        • remove_edge(): remove a hyperedge
        • incidence_matrix(): calculate an incidence matrix and store this matrix in inci_matrix
        • copy(): make a copy of graph
    • Hgraph.Create_Normal: undirected normal graph object, including the following features and methods:
      • Features:
        • vertices: number of vertices
        • adj: adjacency list of graph
      • Methods:
        • add_edge(): add edge
        • dfs_utility(): depth-first search algorithm to traverse the graph
        • connected_components(): return a list of connected components
        • copy(): make a copy of graph
    • Hgraph.Create_Direct: directed hypergraph object (inherit class of Create), including the following features and methods:
      • Features:
        • edges_direct: set of directed hyperedges, in form [start, end], where start and end are subsets of vertex set
      • Methods:
        • add_edge_direct(): add a directed hyperedge
    • Hgraph.Multilayer: multilayer hypergraph object, including the following features and methods:
      • Features:
        • layers: list of hypergraphs
        • interlink: set of interlinking hyperedge
      • Methods:
        • add_graph(): add layer
        • add_interlink(): add interlinking hyperedge
        • number_of_layer: return number of layers

Analyze tools

  • HyperRD.Halgorithm: tools to analyze hypergraphs
    • vertex_connected(): check if two vertices are connected
    • graph_connected(): check if a hypergraph is fully connected
    • components_connected(): return a list of connected components in the hypergraph
    • simple_reduction(): reduce hypergraph to simple hypergraph (has no repeated hyperedge)
    • graph_expansion(): expand a hypergraph to a normal graph, based on chapter 2 of this book Hypergraph Computation
      • mode == 'clique': clique expansion
      • mode == 'star': star expansion or birpartite equivalence
      • mode == 'line': line expansion (still developed)
  • HyperRD.Hmetric: metrics on hypergraphs
    • density(): return the density of hypergraph
    • girth(): return the size of the smallest non-empty hyperedge in the hypergraph
    • average_vertex_degree(): return the average degree across all vertices in the hypergraph
    • average_edge_size(): return the average size across all edges in the hypergraph

Random hypergraph generator

  • HyperRD.Hrandom: generate random hypergraphs
    • simple_matrix(): each element of an incidence matrix will be set value 1 randomly with probability p (uniform distribution)
    • simple_bipartite(): create a random hypergraph with probability p (uniform distribution)
    • simple_powersets(): create a random hypergraph with probability p, based on the random choice of all possible edges (power set of vertices) (uniform distribution)
    • simple_order(): similar to simple_powersets(), but the degree of each hyperedge has a bound (the cardinality of the hyperedge is less than a fixed integer) (uniform distribution)
    • k_uniform(): create a k-uniform hypergraph with probability p (uniform distribution)

Stochastic processes on hypergraph

  • HyperRD.Hdynamic: analyze stochastic processes on hypergraph
    • transit_prob_matrix(): return a uniform transition probability matrix of hypergraph (simple random walk)

Switch to other platforms

  • HyperRD.Htranslate: change to other platforms (check the optional section of library requirement)
    • hyperrd_to_networkx(): switch from Hgraph.Create_Normal object to NetworkX object
    • hyperrd_to_hypernetx(): switch from Hgraph.Create object to HyperNetX object
    • hyperrd_to_xgi(): switch from Hgraph.Create object to XGI object

About

Python package for Hypergraph Computation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •