undirected-graph

Is there in SQL a way to enforce unicity of undirected edge?

不问归期 提交于 2021-02-17 03:21:35
问题 create table Location ( id integer primary key(1, 1), latitude decimal(8,6), longitude decimal(9,6), address varchar(100), name varchar(60) unique ); create table Journey ( id integer primary key(1,1), id_from integer foreign key references Location(id), id_to integer foreign key references Location(id), name varchar(100) unique, unique(id_from, id_to) ); With this schema, you could create 2 different journeys for a pair of locations, one for the way in and one for the way back. What I want

How do I extract the trees from a graph using Answer Set Programming?

℡╲_俬逩灬. 提交于 2020-12-13 03:27:15
问题 There is an undirected graph (V,E), weights on the edges w : E → N, a target k ∈ N, and a threshold O ∈ N. Find a k-vertices tree of the graph of weight less than the threshold. In other words, select k vertices and k - 1 edges from V and E respectively such that they constitute a tree, and the sum of the weights of the selected edges are less than O. Write an ASP program that takes V , E, w, k, and O as input, and finds a selection of edges satisfying the constraints, or outputs

How do I extract the trees from a graph using Answer Set Programming?

岁酱吖の 提交于 2020-12-13 03:26:32
问题 There is an undirected graph (V,E), weights on the edges w : E → N, a target k ∈ N, and a threshold O ∈ N. Find a k-vertices tree of the graph of weight less than the threshold. In other words, select k vertices and k - 1 edges from V and E respectively such that they constitute a tree, and the sum of the weights of the selected edges are less than O. Write an ASP program that takes V , E, w, k, and O as input, and finds a selection of edges satisfying the constraints, or outputs

String Searching Algorithm that uses a graph ? C++

余生长醉 提交于 2020-01-17 20:16:45
问题 Code Instructions Hey guys. Above is a coding project I have been assigned. Im reading the instructions and am completely lost because I've never learned how to code an undirected graph? Not sure how my professor expects us to do this but I was hoping I could get some help from experts. Any readings (or tips) you guys suggest I can look at to familiarize myself with how to get started on the program? Appreciate it, thanks! 回答1: The problem to solve is called "Word Morph". Your instructor gave

String Searching Algorithm that uses a graph ? C++

核能气质少年 提交于 2020-01-17 20:12:08
问题 Code Instructions Hey guys. Above is a coding project I have been assigned. Im reading the instructions and am completely lost because I've never learned how to code an undirected graph? Not sure how my professor expects us to do this but I was hoping I could get some help from experts. Any readings (or tips) you guys suggest I can look at to familiarize myself with how to get started on the program? Appreciate it, thanks! 回答1: The problem to solve is called "Word Morph". Your instructor gave

Matrix formalism NxN adjacency matrix

守給你的承諾、 提交于 2020-01-17 15:23:44
问题 Let A be the NxN adjacency matrix of an undirected unweighted network, without self-loops. Let 1 be a column vector of N elements, all equal to 1. In other words 1 = (1, 1, ..., 1)T , where the superscript T indicates the transpose operation. Use the matrix formalism (multiplicative constants, multiplication row by column, matrix operations like transpose and trace, etc, but avoid the sum symbol Σ) to write expressions for: a)The vector k whose elements are the degrees ki of all nodes i = 1,

How can I find bridges in an undirected graph? [duplicate]

让人想犯罪 __ 提交于 2019-12-30 05:34:11
问题 This question already has answers here : Bridges in a connected graph (3 answers) Closed 4 years ago . Given an undirected Graph, how can I find all the bridges? I've only found Tarjan's algorithm which seems rather complicated. It seems there should be multiple linear time solutions, but I can't find anything. 回答1: Tarjan's algorithm was the first bridge finding algorithm in an undirected graph that ran in linear time. However a simpler algorithm exists and you can have a look at its