UNPKG

gramoloss

Version:

Graph theory package for edition and computation

72 lines (71 loc) 2.83 kB
import { BasicGraph, Graph } from "./graph"; import { BasicLinkData, BasicVertexData } from "./traits"; export declare class AbstractGraph extends Graph<void, void> { constructor(); static fromEdgesListDefault(edgesList: Array<[number, number]>): AbstractGraph; static fromArcsListDefault(arcsList: Array<[number, number]>): AbstractGraph; /** * @returns Petersen graph (10 vertices, 15 edges) * @see https://en.wikipedia.org/wiki/Petersen_graph */ static petersen(): AbstractGraph; /** * Returns a random graph with n vertices. * @param n number of vertices. Should be >= 0. Return empty graph if n < 1. * @param p probabilty of appearance of an edge. Should be between 0 and 1. */ static generateRandomGNP(n: number, p: number): AbstractGraph; /** * Returns a random oriented graph with n vertices. * @param n number of vertices. Should be >= 0. Return empty graph if n < 1. * @param p probabilty of appearance of an edge. Should be between 0 and 1. */ static generateRandomOGNP(n: number, p: number): AbstractGraph; static generateClique(n: number): AbstractGraph; /** * @param n is the number of vertices */ static generatePath(n: number): AbstractGraph; /** * @param n is the number of vertices * @returns an oriented path (`n` vertices and `n-1` edges) */ static orientedPath(n: number): AbstractGraph; /** * @param n is the number of vertices * @returns an oriented cycle (`n` vertices and `n` edges) */ static orientedCycle(n: number): AbstractGraph; /** * See generatePaleyGraph for EmbeddedGraph */ static generatePaley(p: number): AbstractGraph; /** * The line graph is the graph associated to an undirected graph where the vertices are the edges of the initial graph. * Two edges are adjacent in the line graph if they share a common endpoint. * @returns */ static lineGraph<V, L>(graph: Graph<V, L>): AbstractGraph; /** * Return the geometric line graph is the graph whose vertices are the links of the initial graph. * Two links are considered adjacent if the geometric paths intersect (they can intersect at their endpoints). * Therefore the geometric line graph is a super graph of the line graph. * @example for K4 * o---o * |\ /| This K4 embedding * | X | has one more edge in the geometric line graph * |/ \| * o---o * * @example * o * /|\ * / | \ This K4 embedding * / o \ has the same geometric line graph and line graph * /__/ \__\ * o---------o * * */ static geometricLineGraph<V extends BasicVertexData, L extends BasicLinkData>(graph: BasicGraph<V, L>): AbstractGraph; }