All Downloads are FREE. Search and download functionalities are using the official Maven repository.

loggersoft.kotlin.utils.graph.Factory.kt Maven / Gradle / Ivy

There is a newer version: 0.77
Show newest version
/*
 * Copyright (C) 2018 Alexander Kornilov ([email protected])
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@file:Suppress("NOTHING_TO_INLINE")

package loggersoft.kotlin.utils.graph

/**
 * Creates a mutable graph by edges.
 */
fun  graphOf(vararg edges: Edge): Graph = GraphImpl(*edges)

/**
 * Creates a mutable graph with vertexes.
 */
fun  mutableGraphOf(vararg values: V): MutableGraph = MutableGraphImpl(*values)

/**
 * Creates a mutable graph by edges.
 */
fun  mutableGraphOf(vararg edges: Edge): MutableGraph = MutableGraphImpl(*edges)

/**
 * Creates a static edge.
 */
inline fun  edge(startFrom: V,
                                 endWith: V,
                                 value: E,
                                 isOriented: Boolean = true,
                                 hasWeight: Boolean = true,
                                 weight: Double = Edge.DefaultWeight): Edge

        = StaticEdge(startFrom, endWith, value, isOriented, hasWeight, weight)

/**
 * Creates a custom edge.
 */
inline fun  edge(startFrom: V, endWith: V, value: E): Edge
        = ExternalEdge(startFrom, endWith, value)

/**
 * Creates analyst for specified [graph].
 */
fun  analystOf(graph: Graph): Analyst = AnalystImpl(graph)

/**
 * Creates graph and analyst by edges.
 */
inline fun  analystOf(vararg edges: Edge): Analyst = analystOf(graphOf(*edges))




© 2015 - 2025 Weber Informatics LLC | Privacy Policy