Click here to Skip to main content
15,891,513 members
Everything / Graph

Graph

graph

Great Reads

by Bharat Mallapur
Sample project to host MS-Chart in your WPF application
by Dmitrii Nemtsov
A way to build a finite-state machine identifying predefined sequences in a stream of characters
by Chris La
A 2D/3D force directed graph algorithm in C#
by saransh89
How to create stack bar chart using AngularJs and ChartJS

Latest Articles

by Dmitrii Nemtsov
A way to build a finite-state machine identifying predefined sequences in a stream of characters
by IAmJoshChang
Today we are going to demonstrate how to use Top Down Dynamic Programming to solve the problem, Coin Change.
by IAmJoshChang
Graphs are one of the most common questions that might show up in a technical interview, especially in these days where many real-world applications can be represented by nodes and edges such as the social networks!
by IAmJoshChang
How to traverse a postorder binary tree

All Articles

Sort by Updated

Graph 

14 Jan 2024 by Code Artist
Consider this algorithm Implementation Downsampling Algorithm in MSChart Extension[^] to plot large data size without loosing details of trends and performance impact.
13 May 2023 by Dmitrii Nemtsov
A way to build a finite-state machine identifying predefined sequences in a stream of characters
28 Apr 2023 by rhl4569
i have tried to post message in teams channel by using username and password with delegated permissions. but i am getting error. i am using certificate authentication for my tenant id and client id while setting up graph api client. but how to...
27 Mar 2023 by User 15925593
You are given a city network in the form of a tree(an acyclic graph). There are N cities and each city has a unique ID (integer from 1 to N). There exists a unique path between each pair of cities. There are only N-1 paths in the city network....
27 Mar 2023 by KarstenK
It sounds similar like the Travelling salesman problem. So you might look at this problem and its solution. The best solution may be some heuristic approach by trying each combination and evaluate them. Tip: use structs and arrays to write...
26 Mar 2023 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
21 Mar 2023 by OriginalGriff
Don't repost your question: it doesn't help you get an answer quicker, it reduces your chances of getting a solution at all. I'll delete this one.
21 Mar 2023 by Member 15957894
ABC decides to constitute a communication team. A communication team consists of employees such that for every employee who is not in the team, there is a person in the communication team that is familiar with her work. Further the management...
13 Mar 2023 by Member 14734054
I am trying to fetch all the folders in Onedrive(not files) using graph api. I am looking for query similar to the below query: var folders=await client.Me.Drive.Root.Children.Request().GetAsync(); The above query fetches both files and...
13 Mar 2023 by Member 15949866
const searchResponse = { requests: [ { entityTypes: ['driveItem'], query: { queryString: `isDocument=false` }, from: 0, size: 200, fields: [`id`, `name`, `parentReference`], ...
28 Jan 2023 by TejasviniMK
I'm plotting a graph using PictureBox. To fit all the points in the control width, I'm using normal averaging technique. I want to understand is this the only way to do so, or there's any other formula. I feel like loosing the data trend (I can...
26 Sep 2022 by Dvdscot
Hello, I am trying to implement Zoom on this example: How to create a line chart using D3[^] I found several examples of zoom, with axes and without. Generally you need to select an area, call zoom there and this zoom is a d3.zoom which then...
22 Aug 2022 by PaulaJoannAllen
I really need help, please. I look at the chart, and both series have the right values but don't display them, but they only display the first and last values. I managed to get the data for the columns to work, but then the x-axis did not...
22 Aug 2022 by PaulaJoannAllen
private void UpdateChartSeries() { Excel.Worksheet chartWorksheet = (Excel.Worksheet)frmFoodPantry.theWorkbook.Worksheets.get_Item("Totals");//Select the sheet the chart is on // Diaable the alearts ...
8 May 2022 by Bornita Das
I am new to Graph Theory. I am trying to understand the relationship between Strongly connected graphs and Strongly connected components(SCC). Please explain why if there are k SCCs in a graph, we can add atmost 2k edges to make the graph a...
8 May 2022 by Greg Utas
O(n) algorithms for finding strongly connected components are referenced here[^]. I think your intuition is correct. However, the wording "we can add at most 2k edges to make the graph a strongly connected one" is confusing. In many such graphs,...
7 May 2022 by Richard MacCutchan
This is the quick answers forum, please see https://www.codeproject.com/KB/FAQs/QuickAnswersFAQ.aspx[^].
21 Mar 2022 by smodak@ats360.com
I am trying to use Microsoft.Graph to access the onedrive files. I am referring to the sample provided on GitHub link https://github.com/OneDrive/onedrive-texteditor-js in this sample while getting the file link(CreateLink). I am getting...
5 Mar 2022 by Junaid Ihsan
I have data in excel sheet, having two columns (YEAR, nT), now I want to plot these two but I'm not getting the required graph, the code is import numpy as np import pandas as pd import matplotlib.pyplot as plt M1 = pd.read_csv('MF.csv',...
18 Jan 2022 by Member 15502389
Hello, That's my solution: 1) Use Tarjan's strongly connected components algorithm to find all connected components, 2) If there is any component larger then 1, you have cycle, so your algorithm should return cycle found, 3) If there isn't,...
18 Jan 2022 by sharopcha
I have this question for ADS passionates. There is a procedure graph. Let's imagine like this. Below I described a graph using an adj list. adjList = { A: [B, D], B: [C], C: [], D: [E] E: [F] F: [] } How can you find and count the...
16 Jan 2022 by Greg Utas
It is very unlikely that anyone will write this code for you. I assume that DFS = depth-first search. That will work, but you have to do a DFS starting from each node in the graph. During the search, you'll need to pass a vector of the nodes...
10 Jan 2022 by Richard MacCutchan
Quote: Javascript, C++, and Java even Python codes are welcome! Sorry, this site does not provide code to order. This is your assignment so you are expected to do the work. People here will help with your code if you have specific problems, but...
7 Jan 2022 by Member 12085717
I have a discontinuous list of numbers N (e.g. { 1, 2, 3, 6, 8, 10}) and i need to progressively create random pairs of numbers in N and store them in a list in which there can't be twice the same pair. For example for a list of 3 different of...
7 Jan 2022 by Annaarddy
Genetic algorithm will work for generating random pairs
27 Dec 2021 by Dawood Ahmad 2021
Hi everyone, I am struggling with a graph algorithm problem in my Data Structures Lab assignment. I am given a weighted graph with N number of vertices. We have a starting point and we want to travel and visit as much vertices as possible, but...
27 Dec 2021 by Patrice T
Quote: I will really appreciate it if you solve this problem with C++ Do you understand that you are basically required to create a solution by- yourself ? And not necessarily the optimum algorithm. Quote: Someone said to me that the problem can...
27 Dec 2021 by Andy Bantly
This problem is discussed in the book Algorithms in C++ volume 5 - Graph Algorithms. I believe your solution is going to be based on minimal spanning trees. The chapter on this topic (chap 20) is very detailed. I think if you can see it, then...
26 Dec 2021 by Greg Utas
I can't see a way to do this except for an exhaustive search (depth-first recursion) from the starting point. Exclude an edge when it has already been traversed in the same direction. When you can't add another edge, compare the number of...
5 Sep 2021 by Priyanka Somani
I'm trying to understand the low time used in tarjan algorithm using the second example given on GFG Tarjan's Algorithm to find Strongly Connected Components - GeeksforGeeks[^] What I have tried: According to GFG the definition of lowtime is...
26 Aug 2021 by CPallini
Suppose you have a way to compute the nth combination of two indices of your list. E.g. list { 4, 8, 9 } combination number pair 0 (4,8) 1 (4,9) 2 (8,4) Then you have two (or...
25 Aug 2021 by Patrice T
Quote: I could try to generate all possible pairs at the start, shuffle the list and pop one element each time I need to add a random pair to my list. Shuffling the complete list is the best overall option. Any other solution is a trade off,...
31 Jul 2021 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
29 Jun 2021 by Aditya Gupta 2021
Arif runs an NGO for the welfare of animals. There are N workers in his NGO and they have been assigned the task to collect funds for the smooth running of the NGO. Arif has the information for each worker of how much amount they could collect...
29 Jun 2021 by OriginalGriff
Compiling does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email...
15 Jun 2021 by Patrice T
Quote: When I debug the code I'm getting runtime error bcz of these 2 lines-ans[a]++ and ans[b]++. Try ans[a-1]++; ans[b-1]++; In C++, arrays and vectors are 0 based: a vector of size n goes from 0 to n-1. Nodes in...
15 Jun 2021 by Priyanka Somani
There is an undirected star graph consisting of n nodes labeled from 1 to n. A star graph is a graph where there is one center node and exactly n - 1 edges that connect the center node with every other node. You are given a 2D integer array edges...
21 May 2021 by Greg Utas
An interesting problem, which is described here[^], including how to use a heap. I wasn't sure if the question meant "use the C++ heap" (dynamic memory allocation) or "use a heap data structure" (which is what the article suggests to improve the...
21 May 2021 by Nitish kumar May2021
Write a code in C++ of prim's algorithm implementation using heap. What I have tried: Can't get to much idea. I am still studying Data Structure
21 May 2021 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
18 Apr 2021 by Meso97
I need to convert xml file to graph to generate test cases from it. What I have tried: I tried using jgraphx library but i don't have any documentation to use it, so i didn't understand any thing.
18 Apr 2021 by Richard MacCutchan
The documentation is at JGraphX User Manual[^]
17 Apr 2021 by Dương Dương
An intranet has n computers numbered 1 through n and m one-way communication links between several servers. A path of the form u, v, t represents the time it takes to transfer a file from server u to server v as t. When a computer receives a file...
17 Apr 2021 by KarstenK
Nice try, but it isnt a C++ solution worth its name. You need more structure like with classes, structs and functions. It is used to gain some clean code for beginners. Be aware that your homework will be read by your teacher or tutor and he...
19 Mar 2021 by wayne halks
I have to build a function that returns an integer which is the number of connected components in the graph. What I have tried: I've implemented code to create the graph when adding edges or vertices. using namespace std; void...
19 Mar 2021 by Greg Utas
By connected components, I assume you mean the number of disjoint subgraphs. If so, I would use an edge deletion algorithm. Put each vertex in a separate set and then iterate over the edges. For each edge, combine the two sets that contain the...
1 Mar 2021 by Member 15086979
I've made a program but I'm having trouble trying to execute a condition if the value entered in the textbox by the user is greater than the value in a label then the value doesn't get plotted on the graph Currently my graph plots values like...
1 Mar 2021 by Maciej Los
Quote: I want a condition to say if the txtTest2.Text value is greater than the lblvalue then it doesn't show in the chart Stop! Think of it. Label, textbox, etc. is just a control. You have to work on data (graph data). So, all what you need...
1 Mar 2021 by Ralf Meier
txtText2.text is a string. A string could not be compared with a numeric Variable. So ... you should convert your Textbox-Content to the same type than lblvalue should contain ...
17 Dec 2020 by IAmJoshChang
Today we are going to demonstrate how to use Top Down Dynamic Programming to solve the problem, Coin Change.
5 Dec 2020 by Member 15013107
There are two robots A and B moving in an undirected weighted graph G. Since both robots are controlled remotely, at any time, the distance between them must be larger than a positive integer r (the distance between two robots is the length of...
5 Dec 2020 by KarstenK
you must seperate each condition or state into a seperate block or function and than solve it. For that you need some C++ from some C++ tutorial. Use class design like for the robots and the standard library. Make a lot of output, ev write a...
4 Dec 2020 by IAmJoshChang
Graphs are one of the most common questions that might show up in a technical interview, especially in these days where many real-world applications can be represented by nodes and edges such as the social networks!
22 Nov 2020 by Sandeep Mewara
A look into graph based algorithm
14 Oct 2020 by Member 13650651
Excel.ChartObjects xlCharts = (Excel.ChartObjects)oSheet.ChartObjects(Type.Missing); Excel.ChartObject myChart = (Excel.ChartObject)xlCharts.Add(10, 80, 450, 275); oSheet.Shapes.Item("Chart 1").Top = (float)(double)oSheet.get_Range("A15", "A16").Top; ...
14 Oct 2020 by Paraglide
The Collection starts at index 1 not 0
30 Sep 2020 by Prasad C# Coder
I'm totally new to C#, in fact any coding language. I've written a code which takes values (Temp and Weight) from Serial Port (COM Port) and store those values in DataGridView1. Now, as values written to the DataGridView1, I want them to plot on...
30 Sep 2020 by Gerry Schmitz
You have 3 "components": 1) One to collect the data into a queue / collection. (e.g. BackgroundWorker) 2) Another that updates the Grid 3) Another that updates the chart. If #1 uses an observable collection, #2 and #3 can subscribe to the...
28 Sep 2020 by Member 14946863
Hi All, Would you please help for example, how Can I create Google graph curve line chart in visual studio from SQL using vb.net? Thank you in advance. What I have tried: I am very new on coding. I tried to create chart in Excel before, but...
28 Sep 2020 by Sandeep Mewara
You don't need third party, use: System.Windows.Forms.DataVisualization.Charting Have a look at these: Create Multi-Series Line Chart (Graph) in Windows Forms Application using C# and VB.Net[^] Chart Class...
28 Jul 2020 by bswarrior
ı need make a loop from data coordinates for graph, for example ı want to change the plot's color in graph one by one and starts again from the firs one.I'll be glad if you can help me. What I have tried: import numpy as np from matplotlib...
15 Jun 2020 by imabadjoke
public static void main (String [] args){ Scanner sc= new Scanner (System.in); System.out.println("Enter no. of Islands"); int n= sc.nextInt(); Graph g = new Graph (n); System.out.println("Enter no. of...
2 Jun 2020 by Maciej Los
Check this out: Graphs and Dijkstra’s Algorithm (C#) – Bits and Pieces of Code[^] For further details, please see: Shortest path problem - Wikipedia[^]
2 Jun 2020 by skp2235
I want to write a program in C# which will find all paths of open flap envelope form graph (or pentagon graph, see Picture link) without repetition and without lifting the pen; Example solutions are: 321542534; 451234253. - pls see what I've...
30 May 2020 by Member 14538694
i want to implement this Dijkstra's pseudocode exactly to my python graph. Dijkstra's Algorithm DIJKSTRA(G,s,d) //graph, source, destination v ← s //v is always our currently scanned node for all n in G.vertices n.tw ← ∞ s.tw...
30 May 2020 by OriginalGriff
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us...
28 Apr 2020 by Member 14734054
Solved by below code: var folders = await client.Me.Drive.Root.Children.Request().GetAsync(); foreach (var item in folders) { if(item.Folder!=null) { ...
15 Mar 2020 by Member 14773408
I have spent around a full day finding out solution for it , just do it for (1,1) and then it can be easily solved for other cases by moving your bishop to ((r0+c0)//2,(r0+c0)//2) and then to (1,1) now print the same path as in case of (1,1)
8 Mar 2020 by Member 14179777
There is a network of tracks (list), tracks are of two types - standard (with one start and one end point) and with a fork ( one start and two end points). These points are called nodes. It is known that each track can only be connected to one...
8 Mar 2020 by grvgrvgrv
Ada took a standard chessboard with 8 rows (numbered 1 through 8) and 8 columns (numbered 1 through 8); let's denote a cell in row r and column c by (r,c). Then, Ada placed a bishop in a cell (r0,c0) ; it is guaranteed that this cell is black....
3 Mar 2020 by Manujaya Premathilaka
Can a control flow graph contain multiple start and end nodes? If so, what will happen when multiple start and end nodes contain in a control flow graph? Thanks in advance What I have tried: I tried googling but I couldn't find an answer.
3 Mar 2020 by Richard Deeming
A CFG is "a representation, using graph notation, of all paths that might be traversed through a program during its execution". (Control-flow graph - Wikipedia[^]) All but the simplest programs are likely to have multiple end nodes. But a...
25 Dec 2019 by Member 12128269
We have some data in both influxDb and dynamoDb. Now we want to fetch the data from both the DataStores into GraphDB free and make a sparql query by joining the results. What I have tried: We tried to fetch it using the URL directly in the import section of GraphDB Free but we are unable to do...
5 Aug 2019 by geek code
I came across this problem while giving a sample test. The problem was that we have given a tree which is undirected. We can start from any node of our choice. Initially we have power "P" and while going from one node to other node we loose some power "X" (consider as cost of travelling) and...
4 Aug 2019 by Patrice T
Quote: How can i improve it or could u suggest any better/faster algo. Show the calling code with sample data so we have an idea of what you do with this function. Advise: - Double line spacing adds nothing to your code, it just make it more difficult to read. - Learn to indent properly your...
4 Aug 2019 by StoneCoder
My approach : using recursive DFS. Note: i will be running this function for every vertex of graph and this approach works for very small values of vertices. How can i improve it or could u suggest any better/faster algo. Thanks:) What I have tried: static int size=0,source=0; int ans=0;...
28 Jun 2019 by Miranda Powell
I'm trying to put together a few stats about the history of my data to better understand it. My goal is to create a loop which creates a pdf for trend. seasonality and resid for each column in my data frame. I wrote a loop to do this, but each graph includes more data than it should. For...
30 May 2019 by ognjenjebot
If I have a graph looking something like this 0 - 1 - 2 ........|......| .......3.....4 ...............| ...............5 Note: dots have no function, and line represent edges and I have an adjacency matrix for that graph,how do I know only from using that matrix if there is a node,for...
26 Apr 2019 by Patrice T
Quote: How to create graph in PHP First of all, php is server side language, it is used to prepare page that will be sent to client browser. JS and html are client side. There is basically 3 ways to make a graph in an html page. - The canvas which is manipulated on client side by some JS code....
26 Apr 2019 by Member 14314841
How to implement a graph in php. Using Google chart it may be possible But it's in javascript code. Is there any library file are available in PHP for creating a graph ? What I have tried: I tried google chart but it's in javascript .
26 Apr 2019 by MadMyche
Separation of Concerns comes into play here. The Chart is presentation layer and should be one of the last things to do; easiest way to do it would be via JavaScript on the actual webpage. PHP is server-side, and will play the roles of the Business Layer as well as the Data Layer. So how do...
25 Apr 2019 by Christian Graus
PHP runs on the server. Javascript runs on the client and is precisely what you need to use, unless you're determined to generate a static bitmap on the back end and then serve it. I'v never used PHP, but, I imagine it could only do that via a COM object?
20 Apr 2019 by Member 14321210
Screen-Shot-2019-04-20-at-5-08...
20 Apr 2019 by Member 14321210
pred_uc1 = results.get_forecast(steps=30) pred_ci = pred_uc1.conf_int() axes = y.plot(label='A321 Observed', figsize=(14, 7)) pred_uc1.predicted_mean.plot(ax=axes, label='A321 Forecast') pred_uc2 = results.get_forecast(steps=30) pred_ci = pred_uc2.conf_int() ax = y.plot(label='A320 Observed',...
25 Mar 2019 by Daniele Fontani, keggyy
In this article, we explain GraphQL and show how to use it with an unstructured database (MongoDB)
15 Mar 2019 by Darryl Bryk
A software application is presented which facilitates the analysis of crash test data, automatically generates graphs with injury criteria, and generates reports
23 Jan 2019 by Member 14042924
I'm practicing for National programming competition and I came on this problem: We are given undirected complete graph with N vertices. Every edge in graph has color red or green. We should find number of triplets(i,j,k) of vertices such that edges(i,j),(j,k)and(i,k) all have same color. We are...
6 Jan 2019 by TeemeeT
How can I access other users calendar appointments in MS Outlook to validate if the appointment time created in our application are already taken. We have an account to access MS Graph APIs. What I have tried: Access with a signed-in user but I need to have delegate access to users' calendars.
16 Nov 2018 by Rick York
Graph *G = malloc(sizeof(*G)); "He is allocating memory block for one block which will hold the pointer to G" Not exactly. It is allocating a Graph structure and assigning G to the address of that structure. That is certainly readable code but I think it obscures what's really going on,...
16 Nov 2018 by kavinderrana121
My doubt is regarding pointer only,Here head is a double poiner to Queue if we are using *head than we are accessing the location(or address passed) inside main but when we are using simply head than we are using head in the current function only which will hold the address of pointer to Queue...
16 Nov 2018 by CPallini
Let's try a bit of experimental evidence. The program #include #include struct Queue { int data; int priority; struct Queue *next; }; void dump_pointers( struct Queue ** phead) { printf("-- dump_pointers --\n"); printf("phead=%p, *phead=%p &(*phead)=%p\n", phead,...
25 Sep 2018 by OriginalGriff
Compiling does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email contained the message you wanted to send. So now...
25 Sep 2018 by kavinderrana121
I'm studying graphs at the moment, and I'm using C. When I represent a graph with an adjacency list, I need a queue for a BFS traversal. However, I'm having some issues with the code - I'm not sure if I grasped the concept of a bfs traversal with queues well. I pasted the commented code below,...
11 Sep 2018 by Member 13981298
Need to print labels on a GlControl box for a graph. This can be done easily with Glut. However, OpenGL.Net does not seem to support GLUT. What I have tried: Tried writing the string on a bitmap and then print it on the Glcontrol but it prints some garbage value. The application is in WinForm....
17 Aug 2018 by Member 13952951
I have two plots. One is a plot of ten basketball players' paths and because of the coordinate system is scaled to a roughly 50x50 graph. The other is of some basketball half-court plotting code that I found online that is plotting on a roughly 500x500 graph scale. I want to superimpose the...
29 Jun 2018 by Patrice T
Quote: Is there an efficient algorithm for this problem? None, even worse there can be no solution because of infinite looping. Quote: The graph can have cycles, the edge weights could be negative, and the path is allowed to go through a vertex or edge more than once. The combination of those...
29 Jun 2018 by Alexandre Cornet
In my economics research I am currently dealing with a specific shortest path problem: Given a directed deterministic dynamic graph with weights on the edges, I need to find the shortest path from one source S, which goes through N edges. The graph can have cycles, the edge weights could be...
18 Jun 2018 by Member 13647869
I have a csv file that contains the following: the date a tweet is published, the sentiment value (0=negative and 1=positive), and then the tweet in the third column, all seperated by commas. I need to plot the date on the x-axis and the sentiment value on the y-axis to see the change of...
7 Jun 2018 by Stavros Avramidis (asder)
I am making a directed Graph class. I want find if there is any Euler Cycle and update a vector with it's path accordingly. My Function some times work but others add two times the last edge of the path.So i guess it needs to be tydied up. (If others parts of my code are too simple, so I didn't...