@@ -4,7 +4,8 @@ import React, { useState } from 'react';
44import EuclideanMatrixParams from './helpers/EuclideanMatrixParams' ;
55import '../../styles/Param.scss' ;
66import PropTypes from 'prop-types' ; // Import this for URL Param
7- import { withAlgorithmParams } from './helpers/urlHelpers' // Import this for URL Param
7+ import { withAlgorithmParams , addURLGraph } from './helpers/urlHelpers'
8+
89
910const DEFAULT_SIZE = 4 ; // gets overwritten by GRAPH_EGS[0] now
1011const DEFAULT_START = null ; // disable
@@ -30,23 +31,25 @@ const GRAPH_EGS = [ // XXX think up better examples?
3031 edges : '1-2,2-1,2-3,3-4,4-5,5-3'
3132 } ] ;
3233
33- function TransitiveClosureParam ( { mode, size, min, max} ) {
34+ function TransitiveClosureParam ( { mode, xyCoords , edgeWeights , size, start , end , heuristic , min, max } ) {
3435 const [ message , setMessage ] = useState ( null ) ;
36+ let [ start1 , size1 , graph_egs ] =
37+ addURLGraph ( GRAPH_EGS , xyCoords , edgeWeights , start , DEFAULT_START ) ;
3538
3639 return (
3740 < >
3841 { /* Matrix input */ }
3942 < EuclideanMatrixParams
4043 name = "transitiveClosure"
4144 mode = "tc"
42- defaultSize = { size || DEFAULT_SIZE }
43- defaultStart = { DEFAULT_START }
45+ defaultSize = { size1 }
46+ defaultStart = { start1 }
4447 defaultEnd = { DEFAULT_END }
4548 defaultWeight = { DEFAULT_WEIGHT }
4649 defaultHeur = { DEFAULT_HEUR }
4750 min = { min || 1 }
4851 max = { max || 49 }
49- graphEgs = { GRAPH_EGS }
52+ graphEgs = { graph_egs }
5053 ALGORITHM_NAME = { TRANSITIVE_CLOSURE }
5154 EXAMPLE = { TRANSITIVE_CLOSURE_EXAMPLE }
5255 setMessage = { setMessage }
@@ -66,6 +69,11 @@ TransitiveClosureParam.propTypes = {
6669 alg : PropTypes . string . isRequired ,
6770 mode : PropTypes . string . isRequired ,
6871 size : PropTypes . string . isRequired ,
72+ start : PropTypes . string . isRequired ,
73+ end : PropTypes . string . isRequired ,
74+ heuristic : PropTypes . string . isRequired ,
75+ xyCoords : PropTypes . string . isRequired ,
76+ edgeWeights : PropTypes . string . isRequired ,
6977 min : PropTypes . string . isRequired ,
7078 max : PropTypes . string . isRequired ,
7179} ;
0 commit comments