Epilepsy affects 65 million people worldwide. While medications control many, over 20 million patients continue to have seizures despite maximal medical therapy. New surgical techniques, laser thermal ablation and responsive devices are exciting options for these patients, but their effectiveness is limited by our inability to accurately map which brain regions should be removed or treated with electrical stimulation. Currently, this mapping is done manually, but seizure onset patterns on intracranial EEG (IEEG) are frequently not well localized, and clinicians often disagree on seizure onset time, location, and what regions should be targeted. Finally, most patient evaluations present a number of viable options for surgery and device placement. There is currently no way to test the effects of a specific therapeutic approach- an operation or device placement- on outcome other than actually doing the procedure. A technique that could simulate these interventions and pick the best approach for individual patients would be a tremendous step forward in clinical care. In this proposal we develop and validate exciting new methods to localize epileptic networks from intracranial EEG that: (1) replace manual marking by clinicians with automated, objective tools, (2) remove the need for precipitating acute seizures during evaluation to localize them and (3) allow clinicians to simulate the effects of different brain surgeries or device placements for individual patients to select the treatment that will work best for them. This work marries new graph theoretical computational methods to model brain networks from IEEG with state of the art neuroimaging techniques to precisely localize implanted electrodes, devices and brain structure. Adult and pediatric patients undergoing brain implants during evaluation for epilepsy surgery or NeuroPace Responsive Neurostimulator (RNS) device placement will be enrolled at the Hospital of the University of Pennsylvania and Children's Hospital of Philadelphia. We will obtain high-resolution brain imaging before and after electrode implant and after surgery or device placement. Our models, recently published, will be applied to each patient's data and brain regions that drive seizures will be quantitatively identified and mapped to their brain images. Patients will undergo standard invasive therapy, either resection or device implant, and outcome- reduction in seizure frequency- will be compared to the amount of the epileptic network that is removed or stimulated by an implanted device. Finally, we will test our ?virtual resection? technique against each patient's data to predict which therapeutic intervention will be most effective, and compare this prediction to the performed procedure and patient outcome. This work differs from many computational studies in that its focus is on developing practical tools to guide invasive treatment for medication resistant epilepsy. It leverages an established collaboration between experienced clinicians in adult and pediatric epilepsy with experts in neuroimaging, bioengineering, functional neurosurgery and a MacArthur-award-winning computational neuroscientist at the University of Pennsylvania.