vs140580

490 Reputation

8 Badges

5 years, 17 days

MaplePrimes Activity


These are questions asked by vs140580

Let G(V,E)  be a graph

 Step 1 : Choose the subsets S of the V of size k and LABEL it with the say "1"

Step 2: LABEL all the neighbours of the vertices of S with "1"

Step 3: Now LABEL "1" all the UNLABELED neighbours of the previously LABELED veritices only if its neighbours are all LABELED already

Step 4: IF atleast one vertex is LABELED in step 3 then repeat step 3   ELSE  If all vertices are already LABELED with "1" goto step 5 ELSE if some of the VERTICES are still not LABELED we reject this set GOTO step 6

Step 5: append the the the set S into the list 

Step 6: Remove all the perivious labels choose a new set of size k from S label its vertices with "1" and goto step 2  if all all sets of size k have already been choosen we end and print the list.

That is we a Function F(Graph::G,k)     the function which does the above so that it can be called with parameter when required for any graph G

I am going to try too but i am not that great at coding I have desinged the algorithm need help if possible kind help

I will also be trying 

I apologize to distrub all in your busy schedule.

Your work will be surely acknowledged 

First_sample_1.mw

 

https://www.mapleprimes.com/questions/234533-How-To-Relabel-Only-A-Subset-Of-Vertex-Of-G#comment287899

 

Some part in above link

In code attached 

I would like to 

I have to on say L list.

And I have done steps at the top in that code

After the above code I have attached steps

"Find the vertices with the condition that if  all its neighbors are labeled as character (FIND(G)) then label those vertices  also as `character"`  then add those vertices also to  L1 list"  then Need to be do again and again on the same graph with new labels G

If no such vertex exits and NumberOfVertices(G) not equal to numelems(L1) then i have to break out of the loop.

or 

if NumberOfVertices(G)=numelems(L1) then I print That list or store it some where

Please pardon me if my english is bad.

KInd help it will help me a lot and it will surely be acknowledged kind help.

 

The algorithm all told above kind help please please

The help will be surely acknowledged

 

 

 

Give a graph G enumerate all possible shortest paths from that vertex to all other vertices like

From vertex v1

P1={(1,2),(2,3)} shortest path from 1 to 3 is stored in P1

P2={(1,2)} shortest path from 1 to 2 of length 1 

Put all possible path of length k  from a verex v in a list seperate

That is length 1 in a seperate from vertex v in a seperate list 

Etc

Function with be F(Graph::G,v)

Function will return all those lists

restart;
with(GraphTheory);
with(combinat, cartprod);
with(SpecialGraphs);
with(RandomGraphs);

Given any arbitary graph G how many possible paths of length k are possible

G := CartesianProduct(PathGraph(3), PathGraph(3));
s := AllPairsDistance(FLT)

How to find how may possible paths of length say 4 from vertex 1:1 

" for example this CartesianProduct(Path(3),Path(3)) number of possible paths of length 2 are

1:1 - 1:2 -2:2

1:1 -2:1-2:2

1:1-1:2 -1:3

1:1-2:1-3:1

so a total of 2 length paths 

next say how may possible paths of length say 3 from vertex 1:2

similar given a vertex and path length how many possible path of that length are possible from that vertex.

It is not restricted to this graph given any graph G in general , a vertex v and k a path length i should get total number of paths of that length in that graph G

That is function say   F(G::Graph,vertex,k) i should get output of the number of path of length k from that vertex v. 

"Only a idea but I may be wrong 

I had an idea taking a row of a vertex in the graph G in the shortest path matrix and finding the number of possible totals which can get  length k I may be wrong to or correct but I finding to implement this in code neatly too.

That is if (0,1,2,1,3,4,1,2)

The number of possible 2 this are 

0+2=2

0+2=2

1+1=2

1+1=2

1+1=2

So a total of 5 , 2 length path with respect to that vertex moving from left to right

Again if number of 3 length paths 

Moving left to right

0+3=3

1+2=3

1+1+1=3

1+2=3

2+1=3

2+1=3

1+2=3

1+2=3

Total 8 paths of length 3

Until maximum possible length path from that vertex with respect to that graph.

Their is a mistake in the above logic is if the length paths intersection in some edges the path length will decrease so need to be careful so it looks difficult for me.

But I may be wrong in logic need help."

I am trying too

Kind help please your answer will be acknowledged 

Kind help 

Kind help someone please 

I have quite a big code with lot of functions how to convert all together to python in one go 

Or any other way of advice 

As recoding is difficult. Can you help with a small sample program with 2 simple functions returning values

Graph theory and it's algorithms, linear algebra , have used in my program codings mainly 

In small function kind take to a create a small graph find allpairshortestpath 

It would help to understand how it converts

Please help sorry to disturb in your busy schedule

 Function given like this

J:=0

F:=proc(operation)

J:=0;

for i to n do
    for j from i + 1 to n do if A(i, j) = 1 then J := J + mod(X (operation) Y); end if; end do; end do;
end proc;

I have simply put the word operation their to explain

If call the fuction F by F("m")  m means multiple the I should get * operator should multiple and it should multiply

If I call function F by F("A") A means Addition then should get + operator should add and it should do +

If I call function F by F("S")  S means Subtraction then should get - operator should subtract and it should do -

mod means absolute value always

First 13 14 15 16 17 18 19 Last Page 15 of 24