vs140580

495 Reputation

8 Badges

5 years, 41 days

MaplePrimes Activity


These are questions asked by vs140580

Below is python code found in the internet kind help to convert to maple but only thing instead on the input to be string I want it to be a set of integers or array of integers

Kind help

# Python program to print all permutations with repetition

# of characters

  

def toString(List):

    return ''.join(List)

  

# The main function that recursively prints all repeated

# permutations of the given string. It uses data[] to store

# all permutations one by one

def allLexicographicRecur (string, data, last, index):

    length = len(string)

  

    # One by one fix all characters at the given index and

    # recur for the subsequent indexes

    for i in xrange(length):

  

        # Fix the ith character at index and if this is not

        # the last index then recursively call for higher

        # indexes

        data[index] = string[i]

  

        # If this is the last index then print the string

        # stored in data[]

        if index==last:

            print toString(data)

        else:

            allLexicographicRecur(string, data, last, index+1)

  

# This function sorts input string, allocate memory for data

# (needed for allLexicographicRecur()) and calls

# allLexicographicRecur() for printing all permutations

def allLexicographic(string):

    length = len(string)

  

    # Create a temp array that will be used by

    # allLexicographicRecur()

    data = [""] * (length+1)

  

    # Sort the input string so that we get all output strings in

    # lexicographically sorted order

    string = sorted(string)

  

    # Now print all permutaions

    allLexicographicRecur(string, data, length-1, 0)

  

# Driver program to test the above functions

string = "ABC"

print "All permutations with repetition of " + string + " are:"

allLexicographic(string)

restart;
with(GraphTheory);
with(SpecialGraphs);
with(StringTools);
GT := GraphTheory;
G := GT:-SpecialGraphs:-GridGraph(3, 3);
G := Graph(AdjacencyMatrix(G));
H := GT:-SpecialGraphs:-GridGraph(3, 2);
H := Graph(AdjacencyMatrix(H));
GH := CartesianProduct(G, H);
V := Vertices(GH);
P := [];
flag := 0
f := proc(K::string) local L; global P; L := Split(K, ":"); P := [op(P), cat("(", L[1], ",", L[2], ")")]; end proc
if flag = 0 then
    for i to NumberOfVertices(GH) do f(V[i]); end do;
end if
GH := RelabelVertices(GH, P)
DrawGraph(GH, stylesheet = "legacy")
 
I need the graph with those exact relabed vertices type i have done

Now the problem i want my graph a little better in output  i want my vertices a better visible the edges as they more not a issue atleast want the verices a little more visbile and distictive  kind help i apologize for the distubance kind help

the below is output i get i want it more better

G := GridGraph(3, 3);
 DrawGraph(G);

Now in place  of (1,3) i want label 1 , in place  of (2,3) i want label 2, in place  of (3,3) i want label 3, in place  of (1,2) i want label 4, in place  of (2,2) i want label 5,in place  of (3,2) i want label 6,in place  of (1,1) i want label 7,in place  of (2,1) i want label 8,in place  of (3,1) i want label 9

And i want the graph to straight like the above and the edges should be correct and strainght kind help

 

Similary for below

 

G := GridGraph(2, 3);
 
DrawGraph(G);

 

 

Now in place  of (1,3) i want label 1 , in place  of (2,3) i want label 2, in place  of (1,2) i want label 3, in place  of (2,2) i want label 4, in place  of (1,1) i want label 5, in place  of (2,1) i want label 6

 And i want the graph to straight like the above and the edges should be correct and strainght kind help 

 

Kind help in such vertex labeled graph outputs and graphs should be strainght with edges and presented

If i can get both in legacy mode the above all in the above form in the legacy mode it will be more good as i want the color etc like that in my output exactly

 

kind help  i apologize for the disturbance kind help please

Vertices should not have have any of the (1,1),(2,1) etc in the output it should be labeled with the vertex labels as told in that order

And the edges straingth and good.

 

kind help  i apologize for the disturbance kind help please

Here in the above graph we are trying to find the longest distance between two vertices For example now say we consider vertices v_2 and v_4 in the above graph 

P_1 , P_2 ,P_3 are different possible path length in the above graph between v_2 and v_4  and it can be seen now the longest distance is 3 as it is the greatest among all lengths between v_2 and v_4

 

AllPathshortest only does the shortest path

 

can anyone help in the in general  finding the longest path between two vertices a graph if i give the

graph and the two vertices it should longest distance

here between v_2 and v_4 longest or greatest distance is 3 which should  greatest length of the several different paths between v_ 2 and v_4 itself

it should display that value.

kind help if anyone can

I their any way to use sagemath commands in my maplesoft program that want to use graph theory topological indices which in sagemath but i dont know if in maplesoft or anyone has create a package by any chance

 

i can see maple in sagemath in this url https://doc.sagemath.org/html/en/reference/interfaces/sage/interfaces/maple.html

 

but i want other way round sagemath in maple can anyone help as some packages in sage are not in maple i feel

kind help 

First 21 22 23 24 25 Page 23 of 25