D
D
delexa02014-10-30 11:31:36
Counts
delexa0, 2014-10-30 11:31:36

In what direction should we move in the implementation of this program?

the following task
is given a file, for example h2s molecules:
input.txt
3
S1 0.000000 0.000000 0.000000
H2 1 1.290404 0.000000 0.000000
H3 1 1.290393 2 93.512189 0.000000
Where 1 line is the number of atoms n. Then n lines, each containing the following entry:
substance_number(0-n), then the number of the element with which it is associated, the distance from this element, then the number of element1, the angle from this element1, the number of element2, the angle from this element2.
In this example, the molecule is built from sulfur.
The user chooses where to start building the substance and the program rebuilds the table, putting the new substance in the first place, restoring all connections.
For example, the user enters
H.output.txt
3
H1 0.000000 0.000000 0.000000
S2 1 1.290404 0.000000 0.000000 H3
2 1.290393 1
93.512189 0.000000
38dc8ec9a1b1.png
35b23032eb19.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mamkaololosha, 2014-10-30
@mamkaololosha

There are 2 main ways to represent a graph:
1) adjacency matrix
Normal NxN matrix, where 0 are unconnected vertices, 1 are connected
2) connectivity table
Hashtable, where array[i] is a vertex and array[i]->obj->obj these are the vertices with which they are connected.
I think adjacency matrix is ​​better.
---s1 h2 h3
s1 - 1 1
h2 1 - 0
h3 1 0 -

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question