I need to create a function that opens and reads in each line of a text file and generates a graph based on a text file that has a node array in it
for example, the array would be
1 2 3 (node 1 is connected to node 2 and
3)
2 1 5
6 7 (node 2 is connected to node 1,5,6, and 7)
3 1 (node 3 is connected to node 1)
4 5 6 7 (node 4 is
connted to node 5,6,and 7)
5 2 4 6 (node 5 is
connected to node 2,4, and 6)
6 2 4
5 7 (node 6 is connected to node 2,4,5, and 7)
7 2 4 6 (node 7 is
connected to node 2,4, and 6)
And this must be programmed in c++ as well as linklist must be used
Graph in above problem is:

#include<bits/stdc++.h>
using namespace.std;
//Function to add an edge in an undirected graph
void addEdge(vector<int> adj[], int V) // V is no of vertices in the graph
{
adj[u].push_back(v);
adj[v].push_back(u);
}
//Function to print adjacency list of graph
void printGraph(vector<int> adj[], int V)
{
for(int v=0;v<V;++v)
{
cout<<"\n Adjacency list of vertex" << v << "\n head";
for(auto x: adj[v])
cout<<"->" << x;
printf("\n");
}
}
int main()
{
int V =7;
vector<int> adj[V];
addEdge(adj, 1, 2);
addEdge(adj, 1, 3);
addEdge(adj, 2, 5);
addEdge(adj, 2, 6);
addEdge(adj, 2, 7);
addEdge(adj, 4, 5);
addEdge(adj, 4, 6);
addEdge(adj, 4, 7);
addEdge(adj, 5, 6);
addEdge(adj, 6, 7);
return 0;
}
I need to create a function that opens and reads in each line of a text...
JAVA
Write a program that
1. opens a text file
2. reads lines of text from the file
3. Converts each line to uppercase
4. saves them in an ArrayList
5. Writes the list of Strings to a new file named
"CAPSTEXT.txt"
Mainjavo ext.txt Instructions from your teacher 1 My mistress' eyes are nothing like the sun; 2 Coral is far more red than her lips' red; 3 If snow be white, why then her breasts are dun; 4 If...
This is binary search tree problem. The program reads the text file, and creates a binary search tree based on the words in the file. I can create the tree but I also have to store 'the order of insertion' in each node. For example, if text includes "the" 3 times and it is the 1st, 5th, and 9th word in the file, in binary search tree, one node should have string value "the" and array list{1, 5, 9}. How...
I need to create a c++ print function that takes a vector of values ex: <1 2 3 4 5 6> and prints it in the correct way with the given dimensions. Example 2x3 = [[1,2,3],[4,5,6]] or 3x2 = [[1,2],[3,4],[5,6]]. To make this even more difficult there can be 3 dimensional matrixs. For example for <1 2 3 4 5 6 7 8 9 10 11 12> with dimensions depthXheightXwidth: 2x3x2 = [[[1,2],[3,4],[5,6]],[[7,8],[9,10],[11,12]]]. The depth height and width could be...
Write a program that reads the integer numbers in a text file
(numbers.txt) and stores the numbers to a binary file
(binaryNumber.dat). (5 pts)
The number.txt file contains the following numbers:
1 2 3 4 5 6 7 8 9 0
7. Write a program that reads the integer numbers in a text file (numbers.txt) and stores the numbers to a binary file (binaryNumber.dat). (5 pts) The number.txt file contains the following numbers: 1 2 3 4 5 6 7...
Write a program that reads the integer numbers in a text file
(numbers.txt) and stores the numbers to a binary file
(binaryNumber.dat). (5 pts)
The number.txt file contains the following numbers:
1 2 3 4 5 6 7 8 9 0
IN JAVA PLZ
7. Write a program that reads the integer numbers in a text file (numbers.txt) and stores the numbers to a binary file (binaryNumber.dat). (5 pts) The number.txt file contains the following numbers: 1 2 3 4...
1. Create a file that contains 20 integers or download the attached file twenty-integers.txt twenty-integers.txt reads: 12 20 13 45 67 90 100 34 56 89 33 44 66 77 88 99 20 69 45 20 Create a program that: 2. Declares a c-style string array that will store a filename. 3. Prompts the user to enter a filename. Store the file name declared in the c-string. 4. Opens the file. Write code to check the file state. If the...
Lab 10 Write a program that reads the integer numbers in a text file (numbers.txt) and stores the numbers to a binary file (binaryNumber.dat). The number.txt file contains the following numbers: 1 2 3 4 5 6 7 8 9 0
Lab 10 Write a Java program that reads the integer numbers in a text file (numbers.txt) and stores the numbers to a binary file (binaryNumber.dat).The number.txt file contains the following numbers: 1 2 3 4 5 6 7 8 9 0
C++ language Write a program that 1. generates a random integer between 100 and 1000, call the number N 2. reads a file name from the keyboard 3. opens a file for output using the file name from step 2 4. generates N random numbers between 1 and 100 and writes them to the file from step 3 5. closes the file 6. opens the file from steps 3, and 4 for input 7. reads the numbers from the file...
Write a program named text_indexing.c that does the following: Reads text and stores it as one string called text. You can read from a file or from the user. (In my implementation, I read only one paragraph (up to new line) from the user. With this same code, I am able to read data from a file by using input redirection (executable < filename) when I run the program. See sample runs below). You can assume that the text will...