Ejemplo n.º 1
0
 public void prepare()
 {
     Gc = new linknodeBuilder();
     Gb = new linknodeBuilder();
     Gt = new linknodeBuilder();
     Gd = null;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Builds the link path hierarchy model
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="selectedPages">The selected pages.</param>
        /// <param name="output">The output.</param>
        /// <returns></returns>
        public static diagramModel buildModel(this linknodeBuilder source, List <spiderPage> selectedPages, diagramModel output = null)
        {
            if (output == null)
            {
                output = new diagramModel("URL path structure", "Representation of url path structure based on detected links.", diagramDirectionEnum.LR);
            }

            if (!imbWEMManager.settings.postReportEngine.reportBuildDoGraphs)
            {
                return(output);
            }

            Dictionary <diagramNode, List <linknodeElement> > links     = new Dictionary <diagramNode, List <linknodeElement> >();
            Dictionary <diagramNode, List <linknodeElement> > new_links = new Dictionary <diagramNode, List <linknodeElement> >();

            var rootNode = output.AddNode("Root" + " (" + source.root.score + ")", diagramNodeShapeEnum.circle);

            links.Add(rootNode, source.root.items.Values.ToList());
            int c = 0;

            do
            {
                new_links = new Dictionary <diagramNode, List <linknodeElement> >();

                foreach (var pair in links)
                {
                    foreach (linknodeElement el in pair.Value)
                    {
                        var parentNode = output.AddNode(el.name + " (" + el.score + ")", diagramNodeShapeEnum.rounded);
                        if (el.items.Count > 0)
                        {
                            new_links.Add(parentNode, el.items.Values.ToList());
                            output.AddLink(pair.Key, parentNode, diagramLinkTypeEnum.normal);
                        }
                        else
                        {
                            output.AddLink(pair.Key, parentNode, diagramLinkTypeEnum.dotted);
                        }
                        c++;
                        if (c > it_limit)
                        {
                            return(output);
                        }
                    }
                }

                links = new_links;
            } while (links.Count > 0);

            return(output);
        }
Ejemplo n.º 3
0
        public void onStartIteration(modelSpiderSiteRecord wRecord)
        {
            Gt = new linknodeBuilder();
            Gc = new linknodeBuilder();

            foreach (spiderTarget target in wRecord.context.targets)
            {
                if (target.isLoaded)
                {
                    Gc.Add(target.url, target, 2);
                }
                else
                {
                    Gt.Add(target.url, target);
                }
            }

            Gd = null;
        }
Ejemplo n.º 4
0
        protected void rebuildGd()
        {
            Gd = new linknodeBuilder();

            foreach (var pair in Gt.newpathNodes)
            {
                string path  = pair.Key;
                int    score = pair.Value.score;

                if (Gc.newpathNodes.Count() > 0)
                {
                    if (Gc.newpathNodes.ContainsKey(path))
                    {
                        score = score / Gc.newpathNodes[path].score;
                    }
                }
                if (Gb.newpathNodes.ContainsKey(path))
                {
                    score = score + Gb.newpathNodes[path].score;
                }
                string opath = Gt.newpathNodes[path].originalPath;
                Gd.Add(opath, Gt.newpathNodes[path].meta, score);
            }

            int             sc     = int.MinValue;
            linknodeElement scBest = null;

            foreach (var nd in Gd.sourceNodeList)
            {
                if (nd.score > sc)
                {
                    sc     = nd.score;
                    scBest = nd;
                }
            }

            bestNode = scBest;
        }