假设我有一个DAG,例如:
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapRoute(
name: "UserIdRoute",
url: "{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
public ActionResult Index(string id)
{
//Get users profile from the database using the id
var viewModel = _userProfileService.Get(id);
return View();
}
是否存在可以执行的索引,可以让我有效地判断节点是否可以从另一个节点访问(在<< O(边缘)中):
A->C
A->D
B->C
B->E
D->F
C->F
C->G
E->G
F->H
G->H